| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(SECKEYPublicKey *k); |
| 94 | 94 |
| 95 /* | 95 /* |
| 96 ** Decode a DER encoded public key into an SECKEYPublicKey structure. | 96 ** Decode a DER encoded public key into an SECKEYPublicKey structure. |
| 97 */ | 97 */ |
| 98 extern SECKEYPublicKey *SECKEY_DecodeDERPublicKey(SECItem *pubkder); | 98 extern SECKEYPublicKey *SECKEY_DecodeDERPublicKey(const SECItem *pubkder); |
| 99 | 99 |
| 100 /* | 100 /* |
| 101 ** Convert a base64 ascii encoded DER public key to our internal format. | 101 ** Convert a base64 ascii encoded DER public key to our internal format. |
| 102 */ | 102 */ |
| 103 extern SECKEYPublicKey *SECKEY_ConvertAndDecodePublicKey(char *pubkstr); | 103 extern SECKEYPublicKey *SECKEY_ConvertAndDecodePublicKey(const char *pubkstr); |
| 104 | 104 |
| 105 /* | 105 /* |
| 106 ** Convert a base64 ascii encoded DER public key and challenge to spki, | 106 ** Convert a base64 ascii encoded DER public key and challenge to spki, |
| 107 ** and verify the signature and challenge data are correct | 107 ** and verify the signature and challenge data are correct |
| 108 */ | 108 */ |
| 109 extern CERTSubjectPublicKeyInfo * | 109 extern CERTSubjectPublicKeyInfo * |
| 110 SECKEY_ConvertAndDecodePublicKeyAndChallenge(char *pkacstr, char *challenge, | 110 SECKEY_ConvertAndDecodePublicKeyAndChallenge(char *pkacstr, char *challenge, |
| 111 void *cx); | 111 void *cx); |
| 112 | 112 |
| 113 /* | 113 /* |
| 114 ** Encode a CERTSubjectPublicKeyInfo structure. into a | 114 ** Encode a CERTSubjectPublicKeyInfo structure. into a |
| 115 ** DER encoded subject public key info. | 115 ** DER encoded subject public key info. |
| 116 */ | 116 */ |
| 117 SECItem * | 117 SECItem * |
| 118 SECKEY_EncodeDERSubjectPublicKeyInfo(SECKEYPublicKey *pubk); | 118 SECKEY_EncodeDERSubjectPublicKeyInfo(SECKEYPublicKey *pubk); |
| 119 | 119 |
| 120 /* | 120 /* |
| 121 ** Decode a DER encoded subject public key info into a | 121 ** Decode a DER encoded subject public key info into a |
| 122 ** CERTSubjectPublicKeyInfo structure. | 122 ** CERTSubjectPublicKeyInfo structure. |
| 123 */ | 123 */ |
| 124 extern CERTSubjectPublicKeyInfo * | 124 extern CERTSubjectPublicKeyInfo * |
| 125 SECKEY_DecodeDERSubjectPublicKeyInfo(SECItem *spkider); | 125 SECKEY_DecodeDERSubjectPublicKeyInfo(const SECItem *spkider); |
| 126 | 126 |
| 127 /* | 127 /* |
| 128 ** Convert a base64 ascii encoded DER subject public key info to our | 128 ** Convert a base64 ascii encoded DER subject public key info to our |
| 129 ** internal format. | 129 ** internal format. |
| 130 */ | 130 */ |
| 131 extern CERTSubjectPublicKeyInfo * | 131 extern CERTSubjectPublicKeyInfo * |
| 132 SECKEY_ConvertAndDecodeSubjectPublicKeyInfo(char *spkistr); | 132 SECKEY_ConvertAndDecodeSubjectPublicKeyInfo(const char *spkistr); |
| 133 | 133 |
| 134 /* | 134 /* |
| 135 * extract the public key from a subject Public Key info structure. | 135 * extract the public key from a subject Public Key info structure. |
| 136 * (used by JSS). | 136 * (used by JSS). |
| 137 */ | 137 */ |
| 138 extern SECKEYPublicKey * | 138 extern SECKEYPublicKey * |
| 139 SECKEY_ExtractPublicKey(CERTSubjectPublicKeyInfo *); | 139 SECKEY_ExtractPublicKey(const CERTSubjectPublicKeyInfo *); |
| 140 | 140 |
| 141 /* | 141 /* |
| 142 ** Destroy a private key object. | 142 ** Destroy a private key object. |
| 143 ** "key" the object | 143 ** "key" the object |
| 144 */ | 144 */ |
| 145 extern void SECKEY_DestroyPrivateKey(SECKEYPrivateKey *key); | 145 extern void SECKEY_DestroyPrivateKey(SECKEYPrivateKey *key); |
| 146 | 146 |
| 147 | 147 |
| 148 /* | 148 /* |
| 149 ** Destroy a public key object. | 149 ** Destroy a public key object. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 176 * poolp is the arena into which the contents of from is to be copied. | 176 * poolp is the arena into which the contents of from is to be copied. |
| 177 * NULL is a valid entry. | 177 * NULL is a valid entry. |
| 178 * to is the destination private key info | 178 * to is the destination private key info |
| 179 * from is the source private key info | 179 * from is the source private key info |
| 180 * if either from or to is NULL or an error occurs, SECFailure is | 180 * if either from or to is NULL or an error occurs, SECFailure is |
| 181 * returned. otherwise, SECSuccess is returned. | 181 * returned. otherwise, SECSuccess is returned. |
| 182 */ | 182 */ |
| 183 extern SECStatus | 183 extern SECStatus |
| 184 SECKEY_CopyPrivateKeyInfo(PLArenaPool *poolp, | 184 SECKEY_CopyPrivateKeyInfo(PLArenaPool *poolp, |
| 185 SECKEYPrivateKeyInfo *to, | 185 SECKEYPrivateKeyInfo *to, |
| 186 » » » SECKEYPrivateKeyInfo *from); | 186 » » » const SECKEYPrivateKeyInfo *from); |
| 187 | 187 |
| 188 extern SECStatus | 188 extern SECStatus |
| 189 SECKEY_CacheStaticFlags(SECKEYPrivateKey* key); | 189 SECKEY_CacheStaticFlags(SECKEYPrivateKey* key); |
| 190 | 190 |
| 191 /* Copy encrypted private key info structure. | 191 /* Copy encrypted private key info structure. |
| 192 * poolp is the arena into which the contents of from is to be copied. | 192 * poolp is the arena into which the contents of from is to be copied. |
| 193 * NULL is a valid entry. | 193 * NULL is a valid entry. |
| 194 * to is the destination encrypted private key info | 194 * to is the destination encrypted private key info |
| 195 * from is the source encrypted private key info | 195 * from is the source encrypted private key info |
| 196 * if either from or to is NULL or an error occurs, SECFailure is | 196 * if either from or to is NULL or an error occurs, SECFailure is |
| 197 * returned. otherwise, SECSuccess is returned. | 197 * returned. otherwise, SECSuccess is returned. |
| 198 */ | 198 */ |
| 199 extern SECStatus | 199 extern SECStatus |
| 200 SECKEY_CopyEncryptedPrivateKeyInfo(PLArenaPool *poolp, | 200 SECKEY_CopyEncryptedPrivateKeyInfo(PLArenaPool *poolp, |
| 201 SECKEYEncryptedPrivateKeyInfo *to, | 201 SECKEYEncryptedPrivateKeyInfo *to, |
| 202 » » » » SECKEYEncryptedPrivateKeyInfo *from); | 202 » » » » const SECKEYEncryptedPrivateKeyInfo *from); |
| 203 /* | 203 /* |
| 204 * Accessor functions for key type of public and private keys. | 204 * Accessor functions for key type of public and private keys. |
| 205 */ | 205 */ |
| 206 KeyType SECKEY_GetPrivateKeyType(SECKEYPrivateKey *privKey); | 206 KeyType SECKEY_GetPrivateKeyType(const SECKEYPrivateKey *privKey); |
| 207 KeyType SECKEY_GetPublicKeyType(SECKEYPublicKey *pubKey); | 207 KeyType SECKEY_GetPublicKeyType(const SECKEYPublicKey *pubKey); |
| 208 | 208 |
| 209 /* | 209 /* |
| 210 * Creates a PublicKey from its DER encoding. | 210 * Creates a PublicKey from its DER encoding. |
| 211 * Currently only supports RSA and DSA keys. | 211 * Currently only supports RSA and DSA keys. |
| 212 */ | 212 */ |
| 213 SECKEYPublicKey* | 213 SECKEYPublicKey* |
| 214 SECKEY_ImportDERPublicKey(SECItem *derKey, CK_KEY_TYPE type); | 214 SECKEY_ImportDERPublicKey(const SECItem *derKey, CK_KEY_TYPE type); |
| 215 | 215 |
| 216 SECKEYPrivateKeyList* | 216 SECKEYPrivateKeyList* |
| 217 SECKEY_NewPrivateKeyList(void); | 217 SECKEY_NewPrivateKeyList(void); |
| 218 | 218 |
| 219 void | 219 void |
| 220 SECKEY_DestroyPrivateKeyList(SECKEYPrivateKeyList *keys); | 220 SECKEY_DestroyPrivateKeyList(SECKEYPrivateKeyList *keys); |
| 221 | 221 |
| 222 void | 222 void |
| 223 SECKEY_RemovePrivateKeyListNode(SECKEYPrivateKeyListNode *node); | 223 SECKEY_RemovePrivateKeyListNode(SECKEYPrivateKeyListNode *node); |
| 224 | 224 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 * is also the length of EC private keys and ECDSA signature components | 261 * is also the length of EC private keys and ECDSA signature components |
| 262 * r and s. | 262 * r and s. |
| 263 * | 263 * |
| 264 * Return 0 on failure (unknown EC domain parameters). | 264 * Return 0 on failure (unknown EC domain parameters). |
| 265 */ | 265 */ |
| 266 extern int SECKEY_ECParamsToBasePointOrderLen(const SECItem *params); | 266 extern int SECKEY_ECParamsToBasePointOrderLen(const SECItem *params); |
| 267 | 267 |
| 268 SEC_END_PROTOS | 268 SEC_END_PROTOS |
| 269 | 269 |
| 270 #endif /* _KEYHI_H_ */ | 270 #endif /* _KEYHI_H_ */ |
| OLD | NEW |