diff options
author | ian.mcgreer%sun.com <devnull@localhost> | 2001-11-02 15:41:54 +0000 |
---|---|---|
committer | ian.mcgreer%sun.com <devnull@localhost> | 2001-11-02 15:41:54 +0000 |
commit | 4ecc5bc814552c668c7c0ecbf475fe2d8b56bd8c (patch) | |
tree | b68c4c5359a829d17bc6bbc3669fac0aa75e15f5 | |
parent | fda1ba001878991efd1501cfde5e3be0c91ab917 (diff) | |
download | nss-hg-4ecc5bc814552c668c7c0ecbf475fe2d8b56bd8c.tar.gz |
need to grab the label attrib value
-rw-r--r-- | security/nss/lib/softoken/pkcs11.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c index 8f25a58d1..5c17b7be8 100644 --- a/security/nss/lib/softoken/pkcs11.c +++ b/security/nss/lib/softoken/pkcs11.c @@ -591,6 +591,7 @@ pk11_handleCertObject(PK11Session *session,PK11Object *object) { CERTDB_TRUSTED_UNKNOWN, CERTDB_TRUSTED_UNKNOWN, CERTDB_TRUSTED_UNKNOWN }; SECStatus rv; + int strlen; if (slot->certDB == NULL) { return CKR_TOKEN_WRITE_PROTECTED; @@ -601,6 +602,12 @@ pk11_handleCertObject(PK11Session *session,PK11Object *object) derCert.data = (unsigned char *)attribute->attrib.pValue; derCert.len = attribute->attrib.ulValueLen ; + attribute = pk11_FindAttribute(object,CKA_LABEL); + strlen = attribute->attrib.ulValueLen; + if (*((char *)attribute->attrib.pValue + strlen) != '\0') strlen++; + label = PORT_ZAlloc(strlen); + memcpy(label, attribute->attrib.pValue, attribute->attrib.ulValueLen); + cert = nsslowcert_DecodeDERCertificate(&derCert,PR_FALSE,label); if (cert == NULL) { pk11_FreeAttribute(attribute); @@ -617,6 +624,7 @@ pk11_handleCertObject(PK11Session *session,PK11Object *object) rv = trust ? nsslowcert_ChangeCertTrust(slot->certDB,cert,trust) : SECSuccess; } + PORT_ZFree(label, PR_TRUE); pk11_FreeAttribute(attribute); if (rv != SECSuccess) { |