summaryrefslogtreecommitdiff
path: root/security/nss/lib/smime/smimeutil.c
diff options
context:
space:
mode:
authorkaie%netscape.com <devnull@localhost>2002-08-26 21:34:31 +0000
committerkaie%netscape.com <devnull@localhost>2002-08-26 21:34:31 +0000
commit202694f509283ec7fa59ab41ae38dffb8101b2ce (patch)
tree3c2db13f53765c89dc773a6c8a245edb1815458a /security/nss/lib/smime/smimeutil.c
parenteefc36d22a2660a2f1bd94165c17ff13fc6bc2da (diff)
downloadnss-hg-202694f509283ec7fa59ab41ae38dffb8101b2ce.tar.gz
b=107034 OE requires special attribute in incoming signed messages to support dual key certificates. Add new function
NSS_CMSSignerInfo_AddMSSMIMEEncKeyPrefs. r=relyea
Diffstat (limited to 'security/nss/lib/smime/smimeutil.c')
-rw-r--r--security/nss/lib/smime/smimeutil.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/security/nss/lib/smime/smimeutil.c b/security/nss/lib/smime/smimeutil.c
index 732d8047b..eaa5d4fa1 100644
--- a/security/nss/lib/smime/smimeutil.c
+++ b/security/nss/lib/smime/smimeutil.c
@@ -681,6 +681,40 @@ loser:
}
/*
+ * NSS_SMIMEUtil_CreateSMIMEEncKeyPrefs - create S/MIME encryption key preferences attr value using MS oid
+ *
+ * "poolp" - arena pool to create the attr value on
+ * "dest" - SECItem to put the data in
+ * "cert" - certificate that should be marked as preferred encryption key
+ * cert is expected to have been verified for EmailRecipient usage.
+ */
+SECStatus
+NSS_SMIMEUtil_CreateMSSMIMEEncKeyPrefs(PLArenaPool *poolp, SECItem *dest, CERTCertificate *cert)
+{
+ SECItem *dummy = NULL;
+ PLArenaPool *tmppoolp = NULL;
+ CERTIssuerAndSN *isn;
+
+ if (cert == NULL)
+ goto loser;
+
+ tmppoolp = PORT_NewArena(1024);
+ if (tmppoolp == NULL)
+ goto loser;
+
+ isn = CERT_GetCertIssuerAndSN(tmppoolp, cert);
+ if (isn == NULL)
+ goto loser;
+
+ dummy = SEC_ASN1EncodeItem(poolp, dest, isn, CERT_IssuerAndSNTemplate);
+
+loser:
+ if (tmppoolp) PORT_FreeArena(tmppoolp, PR_FALSE);
+
+ return (dummy == NULL) ? SECFailure : SECSuccess;
+}
+
+/*
* NSS_SMIMEUtil_GetCertFromEncryptionKeyPreference -
* find cert marked by EncryptionKeyPreference attribute
*