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 * This file contains functions to manage asymetric keys, (public and | 5 * This file contains functions to manage asymetric keys, (public and |
6 * private keys). | 6 * private keys). |
7 */ | 7 */ |
8 #include "seccomon.h" | 8 #include "seccomon.h" |
9 #include "secmod.h" | 9 #include "secmod.h" |
10 #include "secmodi.h" | 10 #include "secmodi.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 pubKey->u.dh.publicValue.len); attrs++; | 147 pubKey->u.dh.publicValue.len); attrs++; |
148 break; | 148 break; |
149 case ecKey: | 149 case ecKey: |
150 keyType = CKK_EC; | 150 keyType = CKK_EC; |
151 PK11_SETATTRS(attrs, CKA_VERIFY, &cktrue, sizeof(CK_BBOOL));attrs++; | 151 PK11_SETATTRS(attrs, CKA_VERIFY, &cktrue, sizeof(CK_BBOOL));attrs++; |
152 PK11_SETATTRS(attrs, CKA_DERIVE, &cktrue, sizeof(CK_BBOOL));attrs++; | 152 PK11_SETATTRS(attrs, CKA_DERIVE, &cktrue, sizeof(CK_BBOOL));attrs++; |
153 signedattr = attrs; | 153 signedattr = attrs; |
154 PK11_SETATTRS(attrs, CKA_EC_PARAMS, | 154 PK11_SETATTRS(attrs, CKA_EC_PARAMS, |
155 pubKey->u.ec.DEREncodedParams.data, | 155 pubKey->u.ec.DEREncodedParams.data, |
156 pubKey->u.ec.DEREncodedParams.len); attrs++; | 156 pubKey->u.ec.DEREncodedParams.len); attrs++; |
157 » if (PR_GetEnv("NSS_USE_DECODED_CKA_EC_POINT")) { | 157 » if (PR_GetEnvSecure("NSS_USE_DECODED_CKA_EC_POINT")) { |
158 PK11_SETATTRS(attrs, CKA_EC_POINT, | 158 PK11_SETATTRS(attrs, CKA_EC_POINT, |
159 pubKey->u.ec.publicValue.data, | 159 pubKey->u.ec.publicValue.data, |
160 pubKey->u.ec.publicValue.len); attrs++; | 160 pubKey->u.ec.publicValue.len); attrs++; |
161 } else { | 161 } else { |
162 pubValue = SEC_ASN1EncodeItem(NULL, NULL, | 162 pubValue = SEC_ASN1EncodeItem(NULL, NULL, |
163 &pubKey->u.ec.publicValue, | 163 &pubKey->u.ec.publicValue, |
164 SEC_ASN1_GET(SEC_OctetStringTemplate)); | 164 SEC_ASN1_GET(SEC_OctetStringTemplate)); |
165 if (pubValue == NULL) { | 165 if (pubValue == NULL) { |
166 if (ckaId) { | 166 if (ckaId) { |
167 SECITEM_FreeItem(ckaId,PR_TRUE); | 167 SECITEM_FreeItem(ckaId,PR_TRUE); |
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 for (i=0; i < objCount ; i++) { | 2374 for (i=0; i < objCount ; i++) { |
2375 SECKEYPrivateKey *privKey = | 2375 SECKEYPrivateKey *privKey = |
2376 PK11_MakePrivKey(slot,nullKey,PR_TRUE,key_ids[i],wincx); | 2376 PK11_MakePrivKey(slot,nullKey,PR_TRUE,key_ids[i],wincx); |
2377 SECKEY_AddPrivateKeyToListTail(keys, privKey); | 2377 SECKEY_AddPrivateKeyToListTail(keys, privKey); |
2378 } | 2378 } |
2379 | 2379 |
2380 PORT_Free(key_ids); | 2380 PORT_Free(key_ids); |
2381 return keys; | 2381 return keys; |
2382 } | 2382 } |
2383 | 2383 |
OLD | NEW |