security/nss/lib/softoken/lowkeyti.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial