1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/softoken/lowkeyti.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,94 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 +#ifndef _LOWKEYTI_H_ 1.8 +#define _LOWKEYTI_H_ 1 1.9 + 1.10 +#include "blapit.h" 1.11 +#include "prtypes.h" 1.12 +#include "plarena.h" 1.13 +#include "secitem.h" 1.14 +#include "secasn1t.h" 1.15 +#include "secoidt.h" 1.16 + 1.17 +/* 1.18 +** Typedef for callback to get a password "key". 1.19 +*/ 1.20 +extern const SEC_ASN1Template nsslowkey_PQGParamsTemplate[]; 1.21 +extern const SEC_ASN1Template nsslowkey_RSAPrivateKeyTemplate[]; 1.22 +extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyTemplate[]; 1.23 +extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyExportTemplate[]; 1.24 +extern const SEC_ASN1Template nsslowkey_DHPrivateKeyTemplate[]; 1.25 +extern const SEC_ASN1Template nsslowkey_DHPrivateKeyExportTemplate[]; 1.26 +#ifndef NSS_DISABLE_ECC 1.27 +#define NSSLOWKEY_EC_PRIVATE_KEY_VERSION 1 /* as per SECG 1 C.4 */ 1.28 +extern const SEC_ASN1Template nsslowkey_ECParamsTemplate[]; 1.29 +extern const SEC_ASN1Template nsslowkey_ECPrivateKeyTemplate[]; 1.30 +#endif /* NSS_DISABLE_ECC */ 1.31 + 1.32 +extern const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[]; 1.33 +extern const SEC_ASN1Template nsslowkey_EncryptedPrivateKeyInfoTemplate[]; 1.34 + 1.35 +/* 1.36 + * PKCS #8 attributes 1.37 + */ 1.38 +struct NSSLOWKEYAttributeStr { 1.39 + SECItem attrType; 1.40 + SECItem *attrValue; 1.41 +}; 1.42 +typedef struct NSSLOWKEYAttributeStr NSSLOWKEYAttribute; 1.43 + 1.44 +/* 1.45 +** A PKCS#8 private key info object 1.46 +*/ 1.47 +struct NSSLOWKEYPrivateKeyInfoStr { 1.48 + PLArenaPool *arena; 1.49 + SECItem version; 1.50 + SECAlgorithmID algorithm; 1.51 + SECItem privateKey; 1.52 + NSSLOWKEYAttribute **attributes; 1.53 +}; 1.54 +typedef struct NSSLOWKEYPrivateKeyInfoStr NSSLOWKEYPrivateKeyInfo; 1.55 +#define NSSLOWKEY_PRIVATE_KEY_INFO_VERSION 0 /* what we *create* */ 1.56 + 1.57 +typedef enum { 1.58 + NSSLOWKEYNullKey = 0, 1.59 + NSSLOWKEYRSAKey = 1, 1.60 + NSSLOWKEYDSAKey = 2, 1.61 + NSSLOWKEYDHKey = 4, 1.62 + NSSLOWKEYECKey = 5 1.63 +} NSSLOWKEYType; 1.64 + 1.65 +/* 1.66 +** An RSA public key object. 1.67 +*/ 1.68 +struct NSSLOWKEYPublicKeyStr { 1.69 + PLArenaPool *arena; 1.70 + NSSLOWKEYType keyType ; 1.71 + union { 1.72 + RSAPublicKey rsa; 1.73 + DSAPublicKey dsa; 1.74 + DHPublicKey dh; 1.75 + ECPublicKey ec; 1.76 + } u; 1.77 +}; 1.78 +typedef struct NSSLOWKEYPublicKeyStr NSSLOWKEYPublicKey; 1.79 + 1.80 +/* 1.81 +** Low Level private key object 1.82 +** This is only used by the raw Crypto engines (crypto), keydb (keydb), 1.83 +** and PKCS #11. Everyone else uses the high level key structure. 1.84 +*/ 1.85 +struct NSSLOWKEYPrivateKeyStr { 1.86 + PLArenaPool *arena; 1.87 + NSSLOWKEYType keyType; 1.88 + union { 1.89 + RSAPrivateKey rsa; 1.90 + DSAPrivateKey dsa; 1.91 + DHPrivateKey dh; 1.92 + ECPrivateKey ec; 1.93 + } u; 1.94 +}; 1.95 +typedef struct NSSLOWKEYPrivateKeyStr NSSLOWKEYPrivateKey; 1.96 + 1.97 +#endif /* _LOWKEYTI_H_ */