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

  1. -- History
  2. --   July 8, 1998       Created.
  3. --   July 9, 1998       Renamed types and enhanced RSAES-OAEP-Params.
  4. --                      Added pkcs1Algorithms.
  5.  
  6.  
  7. --
  8. -- This module defines OIDs used to define
  9. -- PKCS #1 version 2.0
  10. --
  11. PKCS1OIDS 
  12. DEFINITIONS IMPLICIT TAGS ::= BEGIN
  13.  
  14. EXPORTS ALL;
  15.  
  16. -- Object Identifiers --
  17.  
  18. -- The DER for this in hexadecimal is:
  19. -- 06 08 
  20. --    2A 86 48 86 F7 0D 01 01
  21. --
  22. pkcs-1 OBJECT IDENTIFIER ::= {
  23.    iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 }
  24.  
  25. --
  26. -- When the following OIDs are used in an AlgorithmIdentifier
  27. -- the parameters MUST be present and MUST be NULL.
  28. --
  29. rsaEncryption          OBJECT IDENTIFIER ::= { pkcs-1 1 }
  30. md2WithRSAEncryption   OBJECT IDENTIFIER ::= { pkcs-1 2 }
  31. md4WithRSAEncryption   OBJECT IDENTIFIER ::= { pkcs-1 3 }
  32. md5WithRSAEncryption   OBJECT IDENTIFIER ::= { pkcs-1 4 }
  33. sha1WithRSAEncryption  OBJECT IDENTIFIER ::= { pkcs-1 5 }
  34. rsaOAEPEncryptionSET   OBJECT IDENTIFIER ::= { pkcs-1 6 }
  35.  
  36. --
  37. -- When id-RSAES-OAEP is used in an AlgorithmIdentifier
  38. -- the parameters MUST be present and MUST be RSAES-OAEP-params.
  39. --
  40. id-RSAES-OAEP          OBJECT IDENTIFIER ::= { pkcs-1 7 }
  41.  
  42. --
  43. -- When id-mgf1 is used in an AlgorithmIdentifier
  44. -- the parameters MUST be present and MUST be 
  45. -- a DigestAlgorithmIdentifier, specifically sha1Identifier.
  46. --
  47. id-mgf1                OBJECT IDENTIFIER ::= { pkcs-1 8 }
  48.  
  49. --
  50. -- When id-pSpecified is used in an AlgorithmIdentifier
  51. -- the parameters MUST be an OCTET STRING.
  52. --
  53. id-pSpecified OBJECT IDENTIFIER ::= { pkcs-1 9 }
  54.  
  55. --
  56. -- This OID really belongs in a module with the secsig OIDs.
  57. -- There may be duplication definition errors due to putting
  58. -- this OID here.
  59. --
  60. id-sha1                OBJECT IDENTIFIER ::= { 
  61.    iso(1) identified-organization(3) oiw(14) secsig(3)
  62.    algorithms(2) 26 }
  63.  
  64. END  -- PKCS1OIDS
  65.  
  66.  
  67.  
  68. --
  69. -- This module defines primitives used to define
  70. -- PKCS #1 version 2.0
  71. --
  72. PKCS1Basics 
  73. DEFINITIONS IMPLICIT TAGS ::= BEGIN
  74.  
  75. EXPORTS ALL;
  76.  
  77. IMPORTS
  78.    rsaEncryption, md2WithRSAEncryption, md4WithRSAEncryption,
  79.    md5WithRSAEncryption, sha1WithRSAEncryption,
  80.    rsaOAEPEncryptionSET, id-RSAES-OAEP, id-mgf1, id-pSpecified,
  81.    id-sha1
  82.    FROM PKCS1OIDS;
  83.  
  84. ALGORITHM-IDENTIFIER ::= TYPE-IDENTIFIER
  85.  
  86. -- Note: the parameter InfoObjectSet in the following definitions
  87. -- allows a distinct information object set to be specified for
  88. -- sets of algorithms such as:  
  89. -- DigestAlgorithms ALGORITHM-IDENTIFIER ::= {
  90. --    { NULL IDENTIFIED BY id-sha1 },
  91. --    { NULL IDENTIFIED BY id-md5 },
  92. --    { NULL IDENTIFIED BY id-md2 }
  93. -- }
  94. --
  95. AlgorithmIdentifier { ALGORITHM-IDENTIFIER:InfoObjectSet } ::= 
  96. SEQUENCE {
  97.    algorithm   ALGORITHM-IDENTIFIER.&id({InfoObjectSet}),
  98.    parameters  ALGORITHM-IDENTIFIER.&Type({InfoObjectSet}
  99.                                            {@algorithm}) OPTIONAL
  100. }
  101.  
  102. --
  103. -- Allowed OAEP digest algorithms.
  104. --
  105. oaepDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
  106.    { NULL IDENTIFIED BY id-sha1 }
  107. }
  108.  
  109. --
  110. -- Algorithm Identifier for SHA1, which is the OAEP default.
  111. --
  112. sha1Identifier ::= AlgorithmIdentifier { 
  113.    id-sha1, NULL }
  114.  
  115.  
  116. --
  117. -- Allowed Mask Generation Function algorithms.
  118. -- If the identifier is id-mgf1, the parameters
  119. -- are a single digest algorithm identifier.
  120. --
  121. pkcs1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
  122.    { AlgorithmIdentifier { {oaepDigestAlgorithms} },
  123.      IDENTIFIED BY id-mgf1 }
  124. }
  125.  
  126. --
  127. -- Allowed algorithms for pGenFunc.
  128. --
  129. pkcs1PGenAlgorithms ALGORITHM-IDENTIFIER ::= {
  130.    { OCTET STRING IDENTIFIED BY id-pSpecified }
  131. }
  132.  
  133. --
  134. -- Default AlgorithmIdentifier for id-RSAES-OAEP.maskGenFunc.
  135. --
  136. mgf1SHA1Identifier ::= AlgorithmIdentifier { 
  137.    id-mgf1, sha1Identifier }
  138.  
  139. --
  140. -- Type identifier definitions for the PKCS #1 OIDs.
  141. --
  142. pkcs1Algorithms ALGORITHM-IDENTIFIER ::= {
  143.    { NULL IDENTIFIED BY rsaEncryption },
  144.    { NULL IDENTIFIED BY md2WithRSAEncryption },
  145.    { NULL IDENTIFIED BY md4WithRSAEncryption }
  146.    { NULL IDENTIFIED BY md5WithRSAEncryption },
  147.    { NULL IDENTIFIED BY sha1WithRSAEncryption },
  148.    { NULL IDENTIFIED BY rsaOAEPEncryptionSET }
  149.    { RSAES-OAEP-params IDENTIFIED BY id-RSAES-OAEP },
  150.    { AlgorithmIdentifier { {oaepDigestAlgorithms} } 
  151.       IDENTIFIED BY id-mgf1 },
  152.    { OCTET STRING IDENTIFIED BY id-pSpecified }
  153. }
  154.  
  155. END  -- PKCS1Basics
  156.  
  157.  
  158. -- 
  159. -- This module defines the main structures of PKCS #1.
  160. --
  161. PKCS1Definitions 
  162. DEFINITIONS IMPLICIT TAGS ::= BEGIN
  163.  
  164. EXPORTS ALL;
  165.  
  166. IMPORTS
  167.    AlgorithmIdentifier, oaepDigestAlgorithms, 
  168.    pkcs1MGFAlgorithms, mgf1SHA1Identifier
  169.       FROM PKCS1Basics;
  170.  
  171. -- 
  172. -- Representation of RSA public key
  173. --
  174. RSAPublicKey ::= SEQUENCE {
  175.    modulus          INTEGER, -- (Usually large) n = p*q
  176.    publicExponent   INTEGER  -- (Usually small) e 
  177. }
  178.  
  179. -- 
  180. -- Representation of RSA private key with p and q
  181. -- information for the CRT algorithm.
  182. --
  183. RSAPrivateKey ::= SEQUENCE {
  184.    version          INTEGER { RSAPrivateKeyVer0(0) } (RSAPrivateKeyVer0),
  185.    modulus          INTEGER, -- (Usually large) n
  186.    publicExponent   INTEGER, -- (Usually small) e
  187.    privateExponent  INTEGER, -- (Usually large) d
  188.    prime1           INTEGER, -- (Usually large) p
  189.    prime2           INTEGER, -- (Usually large) q
  190.    exponent1        INTEGER, -- (Usually large) d mod (p-1)
  191.    exponent2        INTEGER, -- (Usually large) d mod (q-1)
  192.    coefficient      INTEGER  -- (Usually large) (inverse of q) mod p 
  193. }
  194.  
  195. -- 
  196. -- AlgorithmIdentifier.paramters for id-RSAES-OAEP.
  197. -- Note that the tags in this Sequence are explicit.
  198. --
  199. RSAES-OAEP-params ::=  SEQUENCE { 
  200.    hashFunc         [0] AlgorithmIdentifier { {oaepDigestAlgorithms} } 
  201.                            DEFAULT sha1Identifier,
  202.    maskGenFunc      [1] AlgorithmIdentifier { {pkcs1MGFAlgorithms} }
  203.                            DEFAULT mgf1SHA1Identifier,
  204.    pSourceFunc      [2] AlgorithmIdentifier { {pkcs1PGenAlgorithms} }
  205.                            DEFAULT pSpecifiedEmptyIdentifier
  206. }
  207.  
  208. -- 
  209. -- This identifier means that P is an empty string, so the digest
  210. -- of the empty string appears in the RSA block before masking.
  211. --
  212. pSpecifiedEmptyIdentifier ::= AlgorithmIdentifier {
  213.    id-pSpecified, OCTET STRING SIZE (0)
  214. }
  215.  
  216. -- 
  217. -- Identifier for RSAES-OAEP.
  218. -- The DER Encoding of this is in hexadecimal:
  219. -- 30 0D
  220. --    06 09 
  221. --       2A 86 48 86 F7 0D 01 01 07
  222. --    30 00   
  223. --       Notice that the DER encoding of default values is "empty". 
  224. --
  225. RSAES-OAEP-Default-Identifier ::=  AlgorithmIdentifier {
  226.    id-RSAES-OAEP,
  227.    {  sha1Identifier,
  228.       mgf1SHA1Identifier,
  229.       pSpecifiedEmptyIdentifier
  230.    }
  231. }
  232.  
  233. END -- PKCS1Definitions
  234.  
  235.