| 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 #ifndef _KEYHI_H_ | 5 #ifndef _KEYHI_H_ |
| 6 #define _KEYHI_H_ | 6 #define _KEYHI_H_ |
| 7 | 7 |
| 8 #include "plarena.h" | 8 #include "plarena.h" |
| 9 | 9 |
| 10 #include "seccomon.h" | 10 #include "seccomon.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 /* | 83 /* |
| 84 * create a new EC key pair. The private Key is returned... | 84 * create a new EC key pair. The private Key is returned... |
| 85 */ | 85 */ |
| 86 SECKEYPrivateKey *SECKEY_CreateECPrivateKey(SECKEYECParams *param, | 86 SECKEYPrivateKey *SECKEY_CreateECPrivateKey(SECKEYECParams *param, |
| 87 SECKEYPublicKey **pubk, void *cx); | 87 SECKEYPublicKey **pubk, void *cx); |
| 88 | 88 |
| 89 /* | 89 /* |
| 90 ** Create a subject-public-key-info based on a public key. | 90 ** Create a subject-public-key-info based on a public key. |
| 91 */ | 91 */ |
| 92 extern CERTSubjectPublicKeyInfo * | 92 extern CERTSubjectPublicKeyInfo * |
| 93 SECKEY_CreateSubjectPublicKeyInfo(SECKEYPublicKey *k); | 93 SECKEY_CreateSubjectPublicKeyInfo(const SECKEYPublicKey *k); |
| 94 | |
| 95 /* | |
| 96 ** Decode a DER encoded public key into an SECKEYPublicKey structure. | |
| 97 */ | |
| 98 extern SECKEYPublicKey *SECKEY_DecodeDERPublicKey(const SECItem *pubkder); | |
| 99 | |
| 100 /* | |
| 101 ** Convert a base64 ascii encoded DER public key to our internal format. | |
| 102 */ | |
| 103 extern SECKEYPublicKey *SECKEY_ConvertAndDecodePublicKey(const char *pubkstr); | |
| 104 | 94 |
| 105 /* | 95 /* |
| 106 ** Convert a base64 ascii encoded DER public key and challenge to spki, | 96 ** Convert a base64 ascii encoded DER public key and challenge to spki, |
| 107 ** and verify the signature and challenge data are correct | 97 ** and verify the signature and challenge data are correct |
| 108 */ | 98 */ |
| 109 extern CERTSubjectPublicKeyInfo * | 99 extern CERTSubjectPublicKeyInfo * |
| 110 SECKEY_ConvertAndDecodePublicKeyAndChallenge(char *pkacstr, char *challenge, | 100 SECKEY_ConvertAndDecodePublicKeyAndChallenge(char *pkacstr, char *challenge, |
| 111 void *cx); | 101 void *cx); |
| 112 | 102 |
| 113 /* | 103 /* |
| 114 ** Encode a CERTSubjectPublicKeyInfo structure. into a | 104 ** Encode a CERTSubjectPublicKeyInfo structure. into a |
| 115 ** DER encoded subject public key info. | 105 ** DER encoded subject public key info. |
| 116 */ | 106 */ |
| 117 SECItem * | 107 SECItem * |
| 118 SECKEY_EncodeDERSubjectPublicKeyInfo(SECKEYPublicKey *pubk); | 108 SECKEY_EncodeDERSubjectPublicKeyInfo(const SECKEYPublicKey *pubk); |
| 119 | 109 |
| 120 /* | 110 /* |
| 121 ** Decode a DER encoded subject public key info into a | 111 ** Decode a DER encoded subject public key info into a |
| 122 ** CERTSubjectPublicKeyInfo structure. | 112 ** CERTSubjectPublicKeyInfo structure. |
| 123 */ | 113 */ |
| 124 extern CERTSubjectPublicKeyInfo * | 114 extern CERTSubjectPublicKeyInfo * |
| 125 SECKEY_DecodeDERSubjectPublicKeyInfo(const SECItem *spkider); | 115 SECKEY_DecodeDERSubjectPublicKeyInfo(const SECItem *spkider); |
| 126 | 116 |
| 127 /* | 117 /* |
| 128 ** Convert a base64 ascii encoded DER subject public key info to our | 118 ** Convert a base64 ascii encoded DER subject public key info to our |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 SECKEYEncryptedPrivateKeyInfo *to, | 191 SECKEYEncryptedPrivateKeyInfo *to, |
| 202 const SECKEYEncryptedPrivateKeyInfo *from); | 192 const SECKEYEncryptedPrivateKeyInfo *from); |
| 203 /* | 193 /* |
| 204 * Accessor functions for key type of public and private keys. | 194 * Accessor functions for key type of public and private keys. |
| 205 */ | 195 */ |
| 206 KeyType SECKEY_GetPrivateKeyType(const SECKEYPrivateKey *privKey); | 196 KeyType SECKEY_GetPrivateKeyType(const SECKEYPrivateKey *privKey); |
| 207 KeyType SECKEY_GetPublicKeyType(const SECKEYPublicKey *pubKey); | 197 KeyType SECKEY_GetPublicKeyType(const SECKEYPublicKey *pubKey); |
| 208 | 198 |
| 209 /* | 199 /* |
| 210 * Creates a PublicKey from its DER encoding. | 200 * Creates a PublicKey from its DER encoding. |
| 211 * Currently only supports RSA and DSA keys. | 201 * Currently only supports RSA, DSA, and DH keys. |
| 212 */ | 202 */ |
| 213 SECKEYPublicKey* | 203 SECKEYPublicKey* |
| 214 SECKEY_ImportDERPublicKey(const SECItem *derKey, CK_KEY_TYPE type); | 204 SECKEY_ImportDERPublicKey(const SECItem *derKey, CK_KEY_TYPE type); |
| 215 | 205 |
| 216 SECKEYPrivateKeyList* | 206 SECKEYPrivateKeyList* |
| 217 SECKEY_NewPrivateKeyList(void); | 207 SECKEY_NewPrivateKeyList(void); |
| 218 | 208 |
| 219 void | 209 void |
| 220 SECKEY_DestroyPrivateKeyList(SECKEYPrivateKeyList *keys); | 210 SECKEY_DestroyPrivateKeyList(SECKEYPrivateKeyList *keys); |
| 221 | 211 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 * is also the length of EC private keys and ECDSA signature components | 251 * is also the length of EC private keys and ECDSA signature components |
| 262 * r and s. | 252 * r and s. |
| 263 * | 253 * |
| 264 * Return 0 on failure (unknown EC domain parameters). | 254 * Return 0 on failure (unknown EC domain parameters). |
| 265 */ | 255 */ |
| 266 extern int SECKEY_ECParamsToBasePointOrderLen(const SECItem *params); | 256 extern int SECKEY_ECParamsToBasePointOrderLen(const SECItem *params); |
| 267 | 257 |
| 268 SEC_END_PROTOS | 258 SEC_END_PROTOS |
| 269 | 259 |
| 270 #endif /* _KEYHI_H_ */ | 260 #endif /* _KEYHI_H_ */ |
| OLD | NEW |