| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 #include "secoid.h" | 5 #include "secoid.h" |
| 6 #include "pkcs11t.h" | 6 #include "pkcs11t.h" |
| 7 #include "secitem.h" | 7 #include "secitem.h" |
| 8 #include "secerr.h" | 8 #include "secerr.h" |
| 9 #include "prenv.h" | 9 #include "prenv.h" |
| 10 #include "plhash.h" | 10 #include "plhash.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * | 24 * |
| 25 * NOTE: the first component of the concatenated rcsid string | 25 * NOTE: the first component of the concatenated rcsid string |
| 26 * must not end in a '$' to prevent rcs keyword substitution. | 26 * must not end in a '$' to prevent rcs keyword substitution. |
| 27 */ | 27 */ |
| 28 const char __nss_util_rcsid[] = "$Header: NSS " NSSUTIL_VERSION _DEBUG_STRING | 28 const char __nss_util_rcsid[] = "$Header: NSS " NSSUTIL_VERSION _DEBUG_STRING |
| 29 " " __DATE__ " " __TIME__ " $"; | 29 " " __DATE__ " " __TIME__ " $"; |
| 30 const char __nss_util_sccsid[] = "@(#)NSS " NSSUTIL_VERSION _DEBUG_STRING | 30 const char __nss_util_sccsid[] = "@(#)NSS " NSSUTIL_VERSION _DEBUG_STRING |
| 31 " " __DATE__ " " __TIME__; | 31 " " __DATE__ " " __TIME__; |
| 32 | 32 |
| 33 /* MISSI Mosaic Object ID space */ | 33 /* MISSI Mosaic Object ID space */ |
| 34 /* USGov algorithm OID space: { 2 16 840 1 101 } */ |
| 34 #define USGOV 0x60, 0x86, 0x48, 0x01, 0x65 | 35 #define USGOV 0x60, 0x86, 0x48, 0x01, 0x65 |
| 35 #define MISSI USGOV, 0x02, 0x01, 0x01 | 36 #define MISSI USGOV, 0x02, 0x01, 0x01 |
| 36 #define MISSI_OLD_KEA_DSS MISSI, 0x0c | 37 #define MISSI_OLD_KEA_DSS MISSI, 0x0c |
| 37 #define MISSI_OLD_DSS MISSI, 0x02 | 38 #define MISSI_OLD_DSS MISSI, 0x02 |
| 38 #define MISSI_KEA_DSS MISSI, 0x14 | 39 #define MISSI_KEA_DSS MISSI, 0x14 |
| 39 #define MISSI_DSS MISSI, 0x13 | 40 #define MISSI_DSS MISSI, 0x13 |
| 40 #define MISSI_KEA MISSI, 0x0a | 41 #define MISSI_KEA MISSI, 0x0a |
| 41 #define MISSI_ALT_KEA MISSI, 0x16 | 42 #define MISSI_ALT_KEA MISSI, 0x16 |
| 42 | 43 |
| 43 #define NISTALGS USGOV, 3, 4 | 44 #define NISTALGS USGOV, 3, 4 |
| 44 #define AES NISTALGS, 1 | 45 #define AES NISTALGS, 1 |
| 45 #define SHAXXX NISTALGS, 2 | 46 #define SHAXXX NISTALGS, 2 |
| 47 #define DSA2 NISTALGS, 3 |
| 46 | 48 |
| 47 /** | 49 /** |
| 48 ** The Netscape OID space is allocated by Terry Hayes. If you need | 50 ** The Netscape OID space is allocated by Terry Hayes. If you need |
| 49 ** a piece of the space, contact him at thayes@netscape.com. | 51 ** a piece of the space, contact him at thayes@netscape.com. |
| 50 **/ | 52 **/ |
| 51 | 53 |
| 52 /* Netscape Communications Corporation Object ID space */ | 54 /* Netscape Communications Corporation Object ID space */ |
| 53 /* { 2 16 840 1 113730 } */ | 55 /* { 2 16 840 1 113730 } */ |
| 54 #define NETSCAPE_OID 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42 | 56 #define NETSCAPE_OID 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42 |
| 55 #define NETSCAPE_CERT_EXT NETSCAPE_OID, 0x01 | 57 #define NETSCAPE_CERT_EXT NETSCAPE_OID, 0x01 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 #define RSADSI 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d | 76 #define RSADSI 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d |
| 75 #define PKCS RSADSI, 0x01 | 77 #define PKCS RSADSI, 0x01 |
| 76 #define DIGEST RSADSI, 0x02 | 78 #define DIGEST RSADSI, 0x02 |
| 77 #define CIPHER RSADSI, 0x03 | 79 #define CIPHER RSADSI, 0x03 |
| 78 #define PKCS1 PKCS, 0x01 | 80 #define PKCS1 PKCS, 0x01 |
| 79 #define PKCS5 PKCS, 0x05 | 81 #define PKCS5 PKCS, 0x05 |
| 80 #define PKCS7 PKCS, 0x07 | 82 #define PKCS7 PKCS, 0x07 |
| 81 #define PKCS9 PKCS, 0x09 | 83 #define PKCS9 PKCS, 0x09 |
| 82 #define PKCS12 PKCS, 0x0c | 84 #define PKCS12 PKCS, 0x0c |
| 83 | 85 |
| 84 /* Fortezza algorithm OID space: { 2 16 840 1 101 2 1 1 } */ | |
| 85 /* ### mwelch -- Is this just for algorithms, or all of Fortezza? */ | |
| 86 #define FORTEZZA_ALG 0x60, 0x86, 0x48, 0x01, 0x65, 0x02, 0x01, 0x01 | |
| 87 | |
| 88 /* Other OID name spaces */ | 86 /* Other OID name spaces */ |
| 89 #define ALGORITHM 0x2b, 0x0e, 0x03, 0x02 | 87 #define ALGORITHM 0x2b, 0x0e, 0x03, 0x02 |
| 90 #define X500 0x55 | 88 #define X500 0x55 |
| 91 #define X520_ATTRIBUTE_TYPE X500, 0x04 | 89 #define X520_ATTRIBUTE_TYPE X500, 0x04 |
| 92 #define X500_ALG X500, 0x08 | 90 #define X500_ALG X500, 0x08 |
| 93 #define X500_ALG_ENCRYPTION X500_ALG, 0x01 | 91 #define X500_ALG_ENCRYPTION X500_ALG, 0x01 |
| 94 | 92 |
| 95 /** X.509 v3 Extension OID | 93 /** X.509 v3 Extension OID |
| 96 ** {joint-iso-ccitt (2) ds(5) 29} | 94 ** {joint-iso-ccitt (2) ds(5) 29} |
| 97 **/ | 95 **/ |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 CONST_OID pkcs12V1SecretBag[] = { PKCS12_V1_BAG_IDS, 0x05 }; | 405 CONST_OID pkcs12V1SecretBag[] = { PKCS12_V1_BAG_IDS, 0x05 }; |
| 408 CONST_OID pkcs12V1SafeContentsBag[] = { PKCS12_V1_BAG_IDS, 0x06 }; | 406 CONST_OID pkcs12V1SafeContentsBag[] = { PKCS12_V1_BAG_IDS, 0x06 }; |
| 409 | 407 |
| 410 /* The following encoding is INCORRECT, but correcting it would create a | 408 /* The following encoding is INCORRECT, but correcting it would create a |
| 411 * duplicate OID in the table. So, we will leave it alone. | 409 * duplicate OID in the table. So, we will leave it alone. |
| 412 */ | 410 */ |
| 413 CONST_OID pkcs12KeyUsageAttr[] = { 2, 5, 29, 15 }; | 411 CONST_OID pkcs12KeyUsageAttr[] = { 2, 5, 29, 15 }; |
| 414 | 412 |
| 415 CONST_OID ansix9DSASignature[] = { ANSI_X9_ALGORITHM, 0x01 }; | 413 CONST_OID ansix9DSASignature[] = { ANSI_X9_ALGORITHM, 0x01 }; |
| 416 CONST_OID ansix9DSASignaturewithSHA1Digest[] = { ANSI_X9_ALGORITHM, 0x03 }; | 414 CONST_OID ansix9DSASignaturewithSHA1Digest[] = { ANSI_X9_ALGORITHM, 0x03 }; |
| 415 CONST_OID nistDSASignaturewithSHA224Digest[] = { DSA2, 0x01 }; |
| 416 CONST_OID nistDSASignaturewithSHA256Digest[] = { DSA2, 0x02 }; |
| 417 | 417 |
| 418 /* verisign OIDs */ | 418 /* verisign OIDs */ |
| 419 CONST_OID verisignUserNotices[] = { VERISIGN, 1, 7, 1, 1 }; | 419 CONST_OID verisignUserNotices[] = { VERISIGN, 1, 7, 1, 1 }; |
| 420 | 420 |
| 421 /* pkix OIDs */ | 421 /* pkix OIDs */ |
| 422 CONST_OID pkixCPSPointerQualifier[] = { PKIX_POLICY_QUALIFIERS, 1 }; | 422 CONST_OID pkixCPSPointerQualifier[] = { PKIX_POLICY_QUALIFIERS, 1 }; |
| 423 CONST_OID pkixUserNoticeQualifier[] = { PKIX_POLICY_QUALIFIERS, 2 }; | 423 CONST_OID pkixUserNoticeQualifier[] = { PKIX_POLICY_QUALIFIERS, 2 }; |
| 424 | 424 |
| 425 CONST_OID pkixOCSP[] = { PKIX_OCSP }; | 425 CONST_OID pkixOCSP[] = { PKIX_OCSP }; |
| 426 CONST_OID pkixOCSPBasicResponse[] = { PKIX_OCSP, 1 }; | 426 CONST_OID pkixOCSPBasicResponse[] = { PKIX_OCSP, 1 }; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 446 CONST_OID pkixExtendedKeyUsageClientAuth[] = { PKIX_KEY_USAGE, 2 }; | 446 CONST_OID pkixExtendedKeyUsageClientAuth[] = { PKIX_KEY_USAGE, 2 }; |
| 447 CONST_OID pkixExtendedKeyUsageCodeSign[] = { PKIX_KEY_USAGE, 3 }; | 447 CONST_OID pkixExtendedKeyUsageCodeSign[] = { PKIX_KEY_USAGE, 3 }; |
| 448 CONST_OID pkixExtendedKeyUsageEMailProtect[] = { PKIX_KEY_USAGE, 4 }; | 448 CONST_OID pkixExtendedKeyUsageEMailProtect[] = { PKIX_KEY_USAGE, 4 }; |
| 449 CONST_OID pkixExtendedKeyUsageTimeStamp[] = { PKIX_KEY_USAGE, 8 }; | 449 CONST_OID pkixExtendedKeyUsageTimeStamp[] = { PKIX_KEY_USAGE, 8 }; |
| 450 CONST_OID pkixOCSPResponderExtendedKeyUsage[] = { PKIX_KEY_USAGE, 9 }; | 450 CONST_OID pkixOCSPResponderExtendedKeyUsage[] = { PKIX_KEY_USAGE, 9 }; |
| 451 | 451 |
| 452 /* OIDs for Netscape defined algorithms */ | 452 /* OIDs for Netscape defined algorithms */ |
| 453 CONST_OID netscapeSMimeKEA[] = { NETSCAPE_ALGS, 0x01 }; | 453 CONST_OID netscapeSMimeKEA[] = { NETSCAPE_ALGS, 0x01 }; |
| 454 | 454 |
| 455 /* Fortezza algorithm OIDs */ | 455 /* Fortezza algorithm OIDs */ |
| 456 CONST_OID skipjackCBC[] » » » = { FORTEZZA_ALG, 0x04 }; | 456 CONST_OID skipjackCBC[] » » » = { MISSI, 0x04 }; |
| 457 CONST_OID dhPublicKey[] = { ANSI_X942_ALGORITHM, 0x1 }; | 457 CONST_OID dhPublicKey[] = { ANSI_X942_ALGORITHM, 0x1 }; |
| 458 | 458 |
| 459 CONST_OID aes128_ECB[] = { AES, 1 }; | 459 CONST_OID aes128_ECB[] = { AES, 1 }; |
| 460 CONST_OID aes128_CBC[] = { AES, 2 }; | 460 CONST_OID aes128_CBC[] = { AES, 2 }; |
| 461 #ifdef DEFINE_ALL_AES_CIPHERS | 461 #ifdef DEFINE_ALL_AES_CIPHERS |
| 462 CONST_OID aes128_OFB[] = { AES, 3 }; | 462 CONST_OID aes128_OFB[] = { AES, 3 }; |
| 463 CONST_OID aes128_CFB[] = { AES, 4 }; | 463 CONST_OID aes128_CFB[] = { AES, 4 }; |
| 464 #endif | 464 #endif |
| 465 CONST_OID aes128_KEY_WRAP[] = { AES, 5 }; | 465 CONST_OID aes128_KEY_WRAP[] = { AES, 5 }; |
| 466 | 466 |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 OD( evIncorporationState, SEC_OID_EV_INCORPORATION_STATE, | 1619 OD( evIncorporationState, SEC_OID_EV_INCORPORATION_STATE, |
| 1620 "Jurisdiction of Incorporation State Name", | 1620 "Jurisdiction of Incorporation State Name", |
| 1621 CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION ), | 1621 CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION ), |
| 1622 OD( evIncorporationCountry, SEC_OID_EV_INCORPORATION_COUNTRY, | 1622 OD( evIncorporationCountry, SEC_OID_EV_INCORPORATION_COUNTRY, |
| 1623 "Jurisdiction of Incorporation Country Name", | 1623 "Jurisdiction of Incorporation Country Name", |
| 1624 CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION ), | 1624 CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION ), |
| 1625 OD( x520BusinessCategory, SEC_OID_BUSINESS_CATEGORY, | 1625 OD( x520BusinessCategory, SEC_OID_BUSINESS_CATEGORY, |
| 1626 "Business Category", | 1626 "Business Category", |
| 1627 CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION ), | 1627 CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION ), |
| 1628 | 1628 |
| 1629 OD( nistDSASignaturewithSHA224Digest, |
| 1630 SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA224_DIGEST, |
| 1631 "DSA with SHA-224 Signature", |
| 1632 CKM_INVALID_MECHANISM /* not yet defined */, INVALID_CERT_EXTENSION), |
| 1633 OD( nistDSASignaturewithSHA256Digest, |
| 1634 SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA256_DIGEST, |
| 1635 "DSA with SHA-256 Signature", |
| 1636 CKM_INVALID_MECHANISM /* not yet defined */, INVALID_CERT_EXTENSION) |
| 1629 }; | 1637 }; |
| 1630 | 1638 |
| 1631 /* PRIVATE EXTENDED SECOID Table | 1639 /* PRIVATE EXTENDED SECOID Table |
| 1632 * This table is private. Its structure is opaque to the outside. | 1640 * This table is private. Its structure is opaque to the outside. |
| 1633 * It is indexed by the same SECOidTag as the oids table above. | 1641 * It is indexed by the same SECOidTag as the oids table above. |
| 1634 * Every member of this struct must have accessor functions (set, get) | 1642 * Every member of this struct must have accessor functions (set, get) |
| 1635 * and those functions must operate by value, not by reference. | 1643 * and those functions must operate by value, not by reference. |
| 1636 * The addresses of the contents of this table must not be exposed | 1644 * The addresses of the contents of this table must not be exposed |
| 1637 * by the accessor functions. | 1645 * by the accessor functions. |
| 1638 */ | 1646 */ |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 void UTIL_SetForkState(PRBool forked) | 2170 void UTIL_SetForkState(PRBool forked) |
| 2163 { | 2171 { |
| 2164 parentForkedAfterC_Initialize = forked; | 2172 parentForkedAfterC_Initialize = forked; |
| 2165 } | 2173 } |
| 2166 | 2174 |
| 2167 const char * | 2175 const char * |
| 2168 NSSUTIL_GetVersion(void) | 2176 NSSUTIL_GetVersion(void) |
| 2169 { | 2177 { |
| 2170 return NSSUTIL_VERSION; | 2178 return NSSUTIL_VERSION; |
| 2171 } | 2179 } |
| OLD | NEW |