security/nss/lib/softoken/lowkeyti.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4 #ifndef _LOWKEYTI_H_
michael@0 5 #define _LOWKEYTI_H_ 1
michael@0 6
michael@0 7 #include "blapit.h"
michael@0 8 #include "prtypes.h"
michael@0 9 #include "plarena.h"
michael@0 10 #include "secitem.h"
michael@0 11 #include "secasn1t.h"
michael@0 12 #include "secoidt.h"
michael@0 13
michael@0 14 /*
michael@0 15 ** Typedef for callback to get a password "key".
michael@0 16 */
michael@0 17 extern const SEC_ASN1Template nsslowkey_PQGParamsTemplate[];
michael@0 18 extern const SEC_ASN1Template nsslowkey_RSAPrivateKeyTemplate[];
michael@0 19 extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyTemplate[];
michael@0 20 extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyExportTemplate[];
michael@0 21 extern const SEC_ASN1Template nsslowkey_DHPrivateKeyTemplate[];
michael@0 22 extern const SEC_ASN1Template nsslowkey_DHPrivateKeyExportTemplate[];
michael@0 23 #ifndef NSS_DISABLE_ECC
michael@0 24 #define NSSLOWKEY_EC_PRIVATE_KEY_VERSION 1 /* as per SECG 1 C.4 */
michael@0 25 extern const SEC_ASN1Template nsslowkey_ECParamsTemplate[];
michael@0 26 extern const SEC_ASN1Template nsslowkey_ECPrivateKeyTemplate[];
michael@0 27 #endif /* NSS_DISABLE_ECC */
michael@0 28
michael@0 29 extern const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[];
michael@0 30 extern const SEC_ASN1Template nsslowkey_EncryptedPrivateKeyInfoTemplate[];
michael@0 31
michael@0 32 /*
michael@0 33 * PKCS #8 attributes
michael@0 34 */
michael@0 35 struct NSSLOWKEYAttributeStr {
michael@0 36 SECItem attrType;
michael@0 37 SECItem *attrValue;
michael@0 38 };
michael@0 39 typedef struct NSSLOWKEYAttributeStr NSSLOWKEYAttribute;
michael@0 40
michael@0 41 /*
michael@0 42 ** A PKCS#8 private key info object
michael@0 43 */
michael@0 44 struct NSSLOWKEYPrivateKeyInfoStr {
michael@0 45 PLArenaPool *arena;
michael@0 46 SECItem version;
michael@0 47 SECAlgorithmID algorithm;
michael@0 48 SECItem privateKey;
michael@0 49 NSSLOWKEYAttribute **attributes;
michael@0 50 };
michael@0 51 typedef struct NSSLOWKEYPrivateKeyInfoStr NSSLOWKEYPrivateKeyInfo;
michael@0 52 #define NSSLOWKEY_PRIVATE_KEY_INFO_VERSION 0 /* what we *create* */
michael@0 53
michael@0 54 typedef enum {
michael@0 55 NSSLOWKEYNullKey = 0,
michael@0 56 NSSLOWKEYRSAKey = 1,
michael@0 57 NSSLOWKEYDSAKey = 2,
michael@0 58 NSSLOWKEYDHKey = 4,
michael@0 59 NSSLOWKEYECKey = 5
michael@0 60 } NSSLOWKEYType;
michael@0 61
michael@0 62 /*
michael@0 63 ** An RSA public key object.
michael@0 64 */
michael@0 65 struct NSSLOWKEYPublicKeyStr {
michael@0 66 PLArenaPool *arena;
michael@0 67 NSSLOWKEYType keyType ;
michael@0 68 union {
michael@0 69 RSAPublicKey rsa;
michael@0 70 DSAPublicKey dsa;
michael@0 71 DHPublicKey dh;
michael@0 72 ECPublicKey ec;
michael@0 73 } u;
michael@0 74 };
michael@0 75 typedef struct NSSLOWKEYPublicKeyStr NSSLOWKEYPublicKey;
michael@0 76
michael@0 77 /*
michael@0 78 ** Low Level private key object
michael@0 79 ** This is only used by the raw Crypto engines (crypto), keydb (keydb),
michael@0 80 ** and PKCS #11. Everyone else uses the high level key structure.
michael@0 81 */
michael@0 82 struct NSSLOWKEYPrivateKeyStr {
michael@0 83 PLArenaPool *arena;
michael@0 84 NSSLOWKEYType keyType;
michael@0 85 union {
michael@0 86 RSAPrivateKey rsa;
michael@0 87 DSAPrivateKey dsa;
michael@0 88 DHPrivateKey dh;
michael@0 89 ECPrivateKey ec;
michael@0 90 } u;
michael@0 91 };
michael@0 92 typedef struct NSSLOWKEYPrivateKeyStr NSSLOWKEYPrivateKey;
michael@0 93
michael@0 94 #endif /* _LOWKEYTI_H_ */

mercurial