home *** CD-ROM | disk | FTP | other *** search
/ ftp.rsa.com / 2014.05.ftp.rsa.com.tar / ftp.rsa.com / pub / pkcs / pkcs-1 / pkcs-1v2-1.asn < prev    next >
Text File  |  2014-05-02  |  10KB  |  335 lines

  1. PKCS-1 {
  2.     iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) modules(0)
  3.     pkcs-1(1) 
  4. }
  5.  
  6. -- $ Revision: 2.1 $
  7.  
  8. -- This module has been checked for conformance with the ASN.1 standard by 
  9. -- the OSS ASN.1 Tools
  10.  
  11. DEFINITIONS EXPLICIT TAGS ::=
  12.  
  13. BEGIN
  14.  
  15. -- EXPORTS ALL
  16. -- All types and values defined in this module are exported for use in other 
  17. -- ASN.1 modules.
  18.  
  19. IMPORTS
  20.  
  21. id-sha256, id-sha384, id-sha512 
  22.     FROM NIST-SHA2 {
  23.         joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) 
  24.         csor(3) nistalgorithm(4) modules(0) sha2(1)
  25.     };
  26.  
  27. -- ============================
  28. --   Basic object identifiers 
  29. -- ============================
  30.  
  31. -- The DER encoding of this in hexadecimal is:
  32. -- (0x)06 08 
  33. --        2A 86 48 86 F7 0D 01 01
  34. --
  35. pkcs-1    OBJECT IDENTIFIER ::= { 
  36.     iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1
  37. }
  38.  
  39. --
  40. -- When rsaEncryption is used in an AlgorithmIdentifier the parameters 
  41. -- MUST be present and MUST be NULL.
  42. --
  43. rsaEncryption    OBJECT IDENTIFIER ::= { pkcs-1 1 }
  44.  
  45. --
  46. -- When id-RSAES-OAEP is used in an AlgorithmIdentifier the parameters MUST 
  47. -- be present and MUST be RSAES-OAEP-params.
  48. --
  49. id-RSAES-OAEP    OBJECT IDENTIFIER ::= { pkcs-1 7 }
  50.  
  51. --
  52. -- When id-pSpecified is used in an AlgorithmIdentifier the parameters MUST 
  53. -- be an OCTET STRING.
  54. --
  55. id-pSpecified    OBJECT IDENTIFIER ::= { pkcs-1 9 }
  56.  
  57. --
  58. -- When id-RSASSA-PSS is used in an AlgorithmIdentifier the parameters MUST 
  59. -- be present and MUST be RSASSA-PSS-params.
  60. --
  61. id-RSASSA-PSS    OBJECT IDENTIFIER ::= { pkcs-1 10 }
  62.  
  63. --
  64. -- When the following OIDs are used in an AlgorithmIdentifier the parameters 
  65. -- MUST be present and MUST be NULL.
  66. --
  67. md2WithRSAEncryption       OBJECT IDENTIFIER ::= { pkcs-1 2 }
  68. md5WithRSAEncryption       OBJECT IDENTIFIER ::= { pkcs-1 4 }
  69. sha1WithRSAEncryption      OBJECT IDENTIFIER ::= { pkcs-1 5 }
  70. sha256WithRSAEncryption    OBJECT IDENTIFIER ::= { pkcs-1 11 }
  71. sha384WithRSAEncryption    OBJECT IDENTIFIER ::= { pkcs-1 12 }
  72. sha512WithRSAEncryption    OBJECT IDENTIFIER ::= { pkcs-1 13 }
  73.  
  74. --
  75. -- This OID really belongs in a module with the secsig OIDs.
  76. --
  77. id-sha1    OBJECT IDENTIFIER ::= {
  78.     iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) 26 
  79. }
  80.  
  81. --
  82. -- OIDs for MD2 and MD5, allowed only in EMSA-PKCS1-v1_5.
  83. --
  84. id-md2 OBJECT IDENTIFIER ::= {
  85.     iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 2
  86. }
  87.  
  88. id-md5 OBJECT IDENTIFIER ::= {
  89.     iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 5
  90. }
  91.  
  92. --
  93. -- When id-mgf1 is used in an AlgorithmIdentifier the parameters MUST be 
  94. -- present and MUST be a HashAlgorithm, for example sha1.
  95. --
  96. id-mgf1    OBJECT IDENTIFIER ::= { pkcs-1 8 }
  97.  
  98. -- ================
  99. --   Useful types
  100. -- ================
  101.  
  102. ALGORITHM-IDENTIFIER ::= CLASS {
  103.     &id    OBJECT IDENTIFIER  UNIQUE, 
  104.     &Type  OPTIONAL
  105. }
  106.     WITH SYNTAX { OID &id [PARAMETERS &Type] }
  107.  
  108. -- Note: the parameter InfoObjectSet in the following definitions allows a 
  109. -- distinct information object set to be specified for sets of algorithms 
  110. -- such as:  
  111. -- DigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
  112. --     { OID id-md2  PARAMETERS NULL }|
  113. --     { OID id-md5  PARAMETERS NULL }|
  114. --     { OID id-sha1 PARAMETERS NULL }
  115. -- }
  116. --
  117.  
  118. AlgorithmIdentifier { ALGORITHM-IDENTIFIER:InfoObjectSet } ::= SEQUENCE {
  119.     algorithm   
  120.         ALGORITHM-IDENTIFIER.&id({InfoObjectSet}), 
  121.     parameters  
  122.         ALGORITHM-IDENTIFIER.&Type({InfoObjectSet}{@.algorithm})  OPTIONAL
  123. }
  124.  
  125. -- ==============
  126. --   Algorithms
  127. -- ==============
  128.  
  129. --
  130. -- Allowed EME-OAEP and EMSA-PSS digest algorithms.
  131. --
  132. OAEP-PSSDigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
  133.     { OID id-sha1 PARAMETERS NULL   }|
  134.     { OID id-sha256 PARAMETERS NULL }|
  135.     { OID id-sha384 PARAMETERS NULL }|
  136.     { OID id-sha512 PARAMETERS NULL }, 
  137.     ...  -- Allows for future expansion --
  138. }
  139.  
  140. --
  141. -- Allowed EMSA-PKCS1-v1_5 digest algorithms.
  142. --
  143. PKCS1-v1-5DigestAlgorithms    ALGORITHM-IDENTIFIER ::= {
  144.     { OID id-md2 PARAMETERS NULL    }|
  145.     { OID id-md5 PARAMETERS NULL    }|
  146.     { OID id-sha1 PARAMETERS NULL   }|
  147.     { OID id-sha256 PARAMETERS NULL }|
  148.     { OID id-sha384 PARAMETERS NULL }|
  149.     { OID id-sha512 PARAMETERS NULL } 
  150. }
  151.  
  152. sha1    HashAlgorithm ::= {
  153.     algorithm   id-sha1, 
  154.     parameters  SHA1Parameters : NULL
  155. }
  156.  
  157. HashAlgorithm ::= AlgorithmIdentifier { {OAEP-PSSDigestAlgorithms} }
  158.  
  159. SHA1Parameters ::= NULL
  160.  
  161. --
  162. -- Allowed mask generation function algorithms. 
  163. -- If the identifier is id-mgf1, the parameters are a HashAlgorithm. 
  164. --
  165. PKCS1MGFAlgorithms    ALGORITHM-IDENTIFIER ::= {
  166.     { OID id-mgf1 PARAMETERS HashAlgorithm }, 
  167.     ...  -- Allows for future expansion --
  168. }
  169.  
  170. --
  171. -- Default AlgorithmIdentifier for id-RSAES-OAEP.maskGenAlgorithm and
  172. -- id-RSASSA-PSS.maskGenAlgorithm.
  173. --
  174. mgf1SHA1    MaskGenAlgorithm ::= {
  175.     algorithm   id-mgf1, 
  176.     parameters  HashAlgorithm : sha1
  177. }
  178.  
  179. MaskGenAlgorithm ::= AlgorithmIdentifier { {PKCS1MGFAlgorithms} }
  180.  
  181. --
  182. -- Allowed algorithms for pSourceAlgorithm.
  183. --
  184. PKCS1PSourceAlgorithms    ALGORITHM-IDENTIFIER ::= {
  185.     { OID id-pSpecified PARAMETERS EncodingParameters }, 
  186.     ...  -- Allows for future expansion --
  187. }
  188.  
  189. EncodingParameters ::= OCTET STRING(SIZE(0..MAX))
  190.  
  191. -- 
  192. -- This identifier means that the label L is an empty string, so the digest 
  193. -- of the empty string appears in the RSA block before masking.
  194. --
  195.  
  196. pSpecifiedEmpty    PSourceAlgorithm ::= {
  197.     algorithm   id-pSpecified, 
  198.     parameters  EncodingParameters : emptyString
  199. }
  200.  
  201. PSourceAlgorithm ::= AlgorithmIdentifier { {PKCS1PSourceAlgorithms} }
  202.  
  203. emptyString    EncodingParameters ::= ''H 
  204.  
  205. --
  206. -- Type identifier definitions for the PKCS #1 OIDs.
  207. --
  208. PKCS1Algorithms    ALGORITHM-IDENTIFIER ::= {
  209.     { OID rsaEncryption              PARAMETERS NULL } |
  210.     { OID md2WithRSAEncryption       PARAMETERS NULL } |
  211.     { OID md5WithRSAEncryption       PARAMETERS NULL } |
  212.     { OID sha1WithRSAEncryption      PARAMETERS NULL } |
  213.     { OID sha256WithRSAEncryption    PARAMETERS NULL } |
  214.     { OID sha384WithRSAEncryption    PARAMETERS NULL } |
  215.     { OID sha512WithRSAEncryption    PARAMETERS NULL } |
  216.     { OID id-RSAES-OAEP PARAMETERS RSAES-OAEP-params } | 
  217.     PKCS1PSourceAlgorithms                             |
  218.     { OID id-RSASSA-PSS PARAMETERS RSASSA-PSS-params } , 
  219.     ...  -- Allows for future expansion --
  220. }
  221.  
  222. -- ===================
  223. --   Main structures
  224. -- ===================
  225.  
  226. RSAPublicKey ::= SEQUENCE {
  227.     modulus           INTEGER,  -- n
  228.     publicExponent    INTEGER   -- e 
  229. }
  230.  
  231. -- 
  232. -- Representation of RSA private key with information for the CRT algorithm.
  233. --
  234. RSAPrivateKey ::= SEQUENCE {
  235.     version           Version, 
  236.     modulus           INTEGER,  -- n
  237.     publicExponent    INTEGER,  -- e
  238.     privateExponent   INTEGER,  -- d
  239.     prime1            INTEGER,  -- p
  240.     prime2            INTEGER,  -- q
  241.     exponent1         INTEGER,  -- d mod (p-1)
  242.     exponent2         INTEGER,  -- d mod (q-1) 
  243.     coefficient       INTEGER,  -- (inverse of q) mod p
  244.     otherPrimeInfos   OtherPrimeInfos OPTIONAL 
  245. }
  246.  
  247. Version ::= INTEGER { two-prime(0), multi(1) }
  248.     (CONSTRAINED BY {-- version must be multi if otherPrimeInfos present --})
  249.  
  250. OtherPrimeInfos ::= SEQUENCE SIZE(1..MAX) OF OtherPrimeInfo
  251.  
  252.  
  253. OtherPrimeInfo ::= SEQUENCE {
  254.     prime             INTEGER,  -- ri
  255.     exponent          INTEGER,  -- di
  256.     coefficient       INTEGER   -- ti
  257. }
  258.  
  259. -- 
  260. -- AlgorithmIdentifier.parameters for id-RSAES-OAEP.
  261. -- Note that the tags in this Sequence are explicit.
  262. --
  263. RSAES-OAEP-params ::= SEQUENCE {
  264.     hashAlgorithm      [0] HashAlgorithm     DEFAULT sha1, 
  265.     maskGenAlgorithm   [1] MaskGenAlgorithm  DEFAULT mgf1SHA1, 
  266.     pSourceAlgorithm   [2] PSourceAlgorithm  DEFAULT pSpecifiedEmpty 
  267. }
  268.  
  269. -- 
  270. -- Identifier for default RSAES-OAEP algorithm identifier.
  271. -- The DER Encoding of this is in hexadecimal:
  272. -- (0x)30 0D
  273. --        06 09 
  274. --           2A 86 48 86 F7 0D 01 01 07
  275. --        30 00   
  276. -- Notice that the DER encoding of default values is "empty". 
  277. --
  278.  
  279. rSAES-OAEP-Default-Identifier    RSAES-AlgorithmIdentifier ::= {
  280.     algorithm   id-RSAES-OAEP, 
  281.     parameters  RSAES-OAEP-params : {
  282.         hashAlgorithm       sha1, 
  283.         maskGenAlgorithm    mgf1SHA1, 
  284.         pSourceAlgorithm    pSpecifiedEmpty
  285.     }
  286. }
  287.  
  288. RSAES-AlgorithmIdentifier ::= AlgorithmIdentifier { {PKCS1Algorithms} }
  289.  
  290. -- 
  291. -- AlgorithmIdentifier.parameters for id-RSASSA-PSS.
  292. -- Note that the tags in this Sequence are explicit.
  293. --
  294. RSASSA-PSS-params ::= SEQUENCE {
  295.     hashAlgorithm      [0] HashAlgorithm      DEFAULT sha1, 
  296.     maskGenAlgorithm   [1] MaskGenAlgorithm   DEFAULT mgf1SHA1, 
  297.     saltLength         [2] INTEGER            DEFAULT 20,
  298.     trailerField       [3] TrailerField       DEFAULT trailerFieldBC
  299. }
  300.  
  301. TrailerField ::= INTEGER { trailerFieldBC(1) }
  302.  
  303. -- 
  304. -- Identifier for default RSASSA-PSS algorithm identifier
  305. -- The DER Encoding of this is in hexadecimal:
  306. -- (0x)30 0D
  307. --        06 09 
  308. --           2A 86 48 86 F7 0D 01 01 0A
  309. --        30 00   
  310. -- Notice that the DER encoding of default values is "empty". 
  311. --
  312. rSASSA-PSS-Default-Identifier    RSASSA-AlgorithmIdentifier ::= {
  313.     algorithm   id-RSASSA-PSS, 
  314.     parameters  RSASSA-PSS-params : {
  315.         hashAlgorithm       sha1, 
  316.         maskGenAlgorithm    mgf1SHA1, 
  317.         saltLength          20,
  318.         trailerField        trailerFieldBC
  319.     }
  320. }
  321.  
  322. RSASSA-AlgorithmIdentifier ::= AlgorithmIdentifier { {PKCS1Algorithms} } 
  323.  
  324. --
  325. -- Syntax for the EMSA-PKCS1-v1_5 hash identifier.
  326. --
  327. DigestInfo ::= SEQUENCE {
  328.     digestAlgorithm DigestAlgorithm,
  329.     digest OCTET STRING 
  330. }
  331.  
  332. DigestAlgorithm ::= AlgorithmIdentifier { {PKCS1-v1-5DigestAlgorithms} }
  333.  
  334. END  -- PKCS1Definitions
  335.