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-2.asn < prev    next >
Text File  |  2014-05-02  |  12KB  |  368 lines

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