michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef _LOWKEYTI_H_ michael@0: #define _LOWKEYTI_H_ 1 michael@0: michael@0: #include "blapit.h" michael@0: #include "prtypes.h" michael@0: #include "plarena.h" michael@0: #include "secitem.h" michael@0: #include "secasn1t.h" michael@0: #include "secoidt.h" michael@0: michael@0: /* michael@0: ** Typedef for callback to get a password "key". michael@0: */ michael@0: extern const SEC_ASN1Template nsslowkey_PQGParamsTemplate[]; michael@0: extern const SEC_ASN1Template nsslowkey_RSAPrivateKeyTemplate[]; michael@0: extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyTemplate[]; michael@0: extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyExportTemplate[]; michael@0: extern const SEC_ASN1Template nsslowkey_DHPrivateKeyTemplate[]; michael@0: extern const SEC_ASN1Template nsslowkey_DHPrivateKeyExportTemplate[]; michael@0: #ifndef NSS_DISABLE_ECC michael@0: #define NSSLOWKEY_EC_PRIVATE_KEY_VERSION 1 /* as per SECG 1 C.4 */ michael@0: extern const SEC_ASN1Template nsslowkey_ECParamsTemplate[]; michael@0: extern const SEC_ASN1Template nsslowkey_ECPrivateKeyTemplate[]; michael@0: #endif /* NSS_DISABLE_ECC */ michael@0: michael@0: extern const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[]; michael@0: extern const SEC_ASN1Template nsslowkey_EncryptedPrivateKeyInfoTemplate[]; michael@0: michael@0: /* michael@0: * PKCS #8 attributes michael@0: */ michael@0: struct NSSLOWKEYAttributeStr { michael@0: SECItem attrType; michael@0: SECItem *attrValue; michael@0: }; michael@0: typedef struct NSSLOWKEYAttributeStr NSSLOWKEYAttribute; michael@0: michael@0: /* michael@0: ** A PKCS#8 private key info object michael@0: */ michael@0: struct NSSLOWKEYPrivateKeyInfoStr { michael@0: PLArenaPool *arena; michael@0: SECItem version; michael@0: SECAlgorithmID algorithm; michael@0: SECItem privateKey; michael@0: NSSLOWKEYAttribute **attributes; michael@0: }; michael@0: typedef struct NSSLOWKEYPrivateKeyInfoStr NSSLOWKEYPrivateKeyInfo; michael@0: #define NSSLOWKEY_PRIVATE_KEY_INFO_VERSION 0 /* what we *create* */ michael@0: michael@0: typedef enum { michael@0: NSSLOWKEYNullKey = 0, michael@0: NSSLOWKEYRSAKey = 1, michael@0: NSSLOWKEYDSAKey = 2, michael@0: NSSLOWKEYDHKey = 4, michael@0: NSSLOWKEYECKey = 5 michael@0: } NSSLOWKEYType; michael@0: michael@0: /* michael@0: ** An RSA public key object. michael@0: */ michael@0: struct NSSLOWKEYPublicKeyStr { michael@0: PLArenaPool *arena; michael@0: NSSLOWKEYType keyType ; michael@0: union { michael@0: RSAPublicKey rsa; michael@0: DSAPublicKey dsa; michael@0: DHPublicKey dh; michael@0: ECPublicKey ec; michael@0: } u; michael@0: }; michael@0: typedef struct NSSLOWKEYPublicKeyStr NSSLOWKEYPublicKey; michael@0: michael@0: /* michael@0: ** Low Level private key object michael@0: ** This is only used by the raw Crypto engines (crypto), keydb (keydb), michael@0: ** and PKCS #11. Everyone else uses the high level key structure. michael@0: */ michael@0: struct NSSLOWKEYPrivateKeyStr { michael@0: PLArenaPool *arena; michael@0: NSSLOWKEYType keyType; michael@0: union { michael@0: RSAPrivateKey rsa; michael@0: DSAPrivateKey dsa; michael@0: DHPrivateKey dh; michael@0: ECPrivateKey ec; michael@0: } u; michael@0: }; michael@0: typedef struct NSSLOWKEYPrivateKeyStr NSSLOWKEYPrivateKey; michael@0: michael@0: #endif /* _LOWKEYTI_H_ */