summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaie%netscape.com <devnull@localhost>2002-04-12 12:56:08 +0000
committerkaie%netscape.com <devnull@localhost>2002-04-12 12:56:08 +0000
commitdbea19e729dca3ba45a261b5fa0b8528509039f0 (patch)
tree4e78cf5043d7b9e46fd9960c56711eff68e38c24
parentfcac19188c20600a8f15583aa62916fa27927e51 (diff)
downloadnss-hg-dbea19e729dca3ba45a261b5fa0b8528509039f0.tar.gz
b=128586 Fix restoring certificates
adt=jaimejr a=rjesup
-rw-r--r--security/nss/lib/softoken/keydb.c15
-rw-r--r--security/nss/lib/softoken/lowkeyti.h9
2 files changed, 24 insertions, 0 deletions
diff --git a/security/nss/lib/softoken/keydb.c b/security/nss/lib/softoken/keydb.c
index 2f9c1bdda..818427a08 100644
--- a/security/nss/lib/softoken/keydb.c
+++ b/security/nss/lib/softoken/keydb.c
@@ -63,6 +63,18 @@
/* Size of the global salt for key database */
#define SALT_LENGTH 16
+const SEC_ASN1Template nsslowkey_AttributeTemplate[] = {
+ { SEC_ASN1_SEQUENCE,
+ 0, NULL, sizeof(NSSLOWKEYAttribute) },
+ { SEC_ASN1_OBJECT_ID, offsetof(NSSLOWKEYAttribute, attrType) },
+ { SEC_ASN1_SET_OF, offsetof(NSSLOWKEYAttribute, attrValue),
+ SEC_AnyTemplate },
+ { 0 }
+};
+
+const SEC_ASN1Template nsslowkey_SetOfAttributeTemplate[] = {
+ { SEC_ASN1_SET_OF, 0, nsslowkey_AttributeTemplate },
+};
/* ASN1 Templates for new decoder/encoder */
const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[] = {
{ SEC_ASN1_SEQUENCE,
@@ -74,6 +86,9 @@ const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[] = {
SECOID_AlgorithmIDTemplate },
{ SEC_ASN1_OCTET_STRING,
offsetof(NSSLOWKEYPrivateKeyInfo,privateKey) },
+ { SEC_ASN1_OPTIONAL | SEC_ASN1_CONSTRUCTED | SEC_ASN1_CONTEXT_SPECIFIC | 0,
+ offsetof(NSSLOWKEYPrivateKeyInfo, attributes),
+ nsslowkey_SetOfAttributeTemplate },
{ 0 }
};
diff --git a/security/nss/lib/softoken/lowkeyti.h b/security/nss/lib/softoken/lowkeyti.h
index dc03c4cdf..48b1837f8 100644
--- a/security/nss/lib/softoken/lowkeyti.h
+++ b/security/nss/lib/softoken/lowkeyti.h
@@ -78,6 +78,14 @@ extern const SEC_ASN1Template nsslowkey_DHPrivateKeyExportTemplate[];
extern const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[];
extern const SEC_ASN1Template nsslowkey_EncryptedPrivateKeyInfoTemplate[];
+/*
+ * PKCS #8 attributes
+ */
+struct NSSLOWKEYAttributeStr {
+ SECItem attrType;
+ SECItem *attrValue;
+};
+typedef struct NSSLOWKEYAttributeStr NSSLOWKEYAttribute;
/*
** A PKCS#8 private key info object
@@ -87,6 +95,7 @@ struct NSSLOWKEYPrivateKeyInfoStr {
SECItem version;
SECAlgorithmID algorithm;
SECItem privateKey;
+ NSSLOWKEYAttribute **attributes;
};
typedef struct NSSLOWKEYPrivateKeyInfoStr NSSLOWKEYPrivateKeyInfo;
#define NSSLOWKEY_PRIVATE_KEY_INFO_VERSION 0 /* what we *create* */