diff options
author | jpierre%netscape.com <devnull@localhost> | 2003-09-19 04:14:50 +0000 |
---|---|---|
committer | jpierre%netscape.com <devnull@localhost> | 2003-09-19 04:14:50 +0000 |
commit | 344c803018ed47424a1ecff8341683732180e94f (patch) | |
tree | ff0157bc845b4a6cebd5b87fe00e43eca52f9b8c /security/nss/lib/smime | |
parent | b7dbfb715beafac22aeee2060d840d4bd88141cd (diff) | |
download | nss-hg-344c803018ed47424a1ecff8341683732180e94f.tar.gz |
Fix for 219524 - support GeneralizedTime in S/MIME v3 signatures. r=wtc, sr=nelsonb
Diffstat (limited to 'security/nss/lib/smime')
-rw-r--r-- | security/nss/lib/smime/cmsattr.c | 2 | ||||
-rw-r--r-- | security/nss/lib/smime/cmssiginfo.c | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/security/nss/lib/smime/cmsattr.c b/security/nss/lib/smime/cmsattr.c index 4217e6c78..03b516f9e 100644 --- a/security/nss/lib/smime/cmsattr.c +++ b/security/nss/lib/smime/cmsattr.c @@ -259,7 +259,7 @@ cms_attr_choose_attr_value_template(void *src_or_dest, PRBool encoding) break; case SEC_OID_PKCS9_SIGNING_TIME: encoded = PR_FALSE; - theTemplate = SEC_ASN1_GET(SEC_UTCTimeTemplate); + theTemplate = SEC_ASN1_GET(CERT_TimeChoiceTemplate); break; /* XXX Want other types here, too */ } diff --git a/security/nss/lib/smime/cmssiginfo.c b/security/nss/lib/smime/cmssiginfo.c index 1d56c7bb6..caed8db89 100644 --- a/security/nss/lib/smime/cmssiginfo.c +++ b/security/nss/lib/smime/cmssiginfo.c @@ -535,7 +535,8 @@ NSS_CMSSignerInfo_GetVersion(NSSCMSSignerInfo *signerinfo) /* * NSS_CMSSignerInfo_GetSigningTime - return the signing time, - * in UTCTime format, of a CMS signerInfo. + * in UTCTime or GeneralizedTime format, + * of a CMS signerInfo. * * sinfo - signerInfo data for this signer * @@ -560,7 +561,7 @@ NSS_CMSSignerInfo_GetSigningTime(NSSCMSSignerInfo *sinfo, PRTime *stime) /* XXXX multi-valued attributes NIH */ if (attr == NULL || (value = NSS_CMSAttribute_GetValue(attr)) == NULL) return SECFailure; - if (DER_UTCTimeToTime(stime, value) != SECSuccess) + if (CERT_DecodeTimeChoice(stime, value) != SECSuccess) return SECFailure; sinfo->signingTime = *stime; /* make cached copy */ return SECSuccess; @@ -697,7 +698,7 @@ NSS_CMSSignerInfo_AddSigningTime(NSSCMSSignerInfo *signerinfo, PRTime t) mark = PORT_ArenaMark(poolp); /* create new signing time attribute */ - if (DER_TimeToUTCTime(&stime, t) != SECSuccess) + if (CERT_EncodeTimeChoice(NULL, &stime, t) != SECSuccess) goto loser; if ((attr = NSS_CMSAttribute_Create(poolp, SEC_OID_PKCS9_SIGNING_TIME, &stime, PR_FALSE)) == NULL) { @@ -881,7 +882,7 @@ NSS_SMIMESignerInfo_SaveSMIMEProfile(NSSCMSSignerInfo *signerinfo) CERTCertificate *cert = NULL; SECItem *profile = NULL; NSSCMSAttribute *attr; - SECItem *utc_stime = NULL; + SECItem *stime = NULL; SECItem *ekp; CERTCertDBHandle *certdb; int save_error; @@ -946,10 +947,10 @@ NSS_SMIMESignerInfo_SaveSMIMEProfile(NSSCMSSignerInfo *signerinfo) attr = NSS_CMSAttributeArray_FindAttrByOidTag(signerinfo->authAttr, SEC_OID_PKCS9_SIGNING_TIME, PR_TRUE); - utc_stime = NSS_CMSAttribute_GetValue(attr); + stime = NSS_CMSAttribute_GetValue(attr); } - rv = CERT_SaveSMimeProfile (cert, profile, utc_stime); + rv = CERT_SaveSMimeProfile (cert, profile, stime); if (must_free_cert) CERT_DestroyCertificate(cert); |