You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2006/01/15 10:12:17 UTC
svn commit: r369189 - /xml/security/trunk/c/src/enc/NSS/NSSCryptoX509.cpp
Author: blautenb
Date: Sun Jan 15 01:12:14 2006
New Revision: 369189
URL: http://svn.apache.org/viewcvs?rev=369189&view=rev
Log:
Update to use CERT_ImportCerts - not really tested yet, but will compile
Modified:
xml/security/trunk/c/src/enc/NSS/NSSCryptoX509.cpp
Modified: xml/security/trunk/c/src/enc/NSS/NSSCryptoX509.cpp
URL: http://svn.apache.org/viewcvs/xml/security/trunk/c/src/enc/NSS/NSSCryptoX509.cpp?rev=369189&r1=369188&r2=369189&view=diff
==============================================================================
--- xml/security/trunk/c/src/enc/NSS/NSSCryptoX509.cpp (original)
+++ xml/security/trunk/c/src/enc/NSS/NSSCryptoX509.cpp Sun Jan 15 01:12:14 2006
@@ -36,6 +36,13 @@
#include <nss/cert.h>
+extern "C" {
+
+extern CERTCertificate *
+__CERT_DecodeDERCertificate (SECItem *derSignedCert, PRBool copyDER, char *nickname);
+
+}
+
#include <xercesc/util/Janitor.hpp>
XSEC_USING_XERCES(ArrayJanitor);
@@ -114,18 +121,34 @@
// Now load certificate
- SECItem i;
- i.type = siBuffer;
- i.data = rawCert;
- i.len = rawCertLen;
-
- mp_cert = __CERT_DecodeDERCertificate(&i, PR_TRUE, NULL);
- // 1. If you got an compiler error here add into "nss/cert.h" delacarion for
- // CERT_DecodeDERCertificate() (the same parameters as for __CERT_DecodeDERCertificate())
- // 2. Since __CERT_DecodeDERCertificate is a private function we might consider using
- // __CERT_NewTempCertificate() or CERT_ImportCerts() instead.
+ SECItem i;
+ i.type = siBuffer;
+ i.data = rawCert;
+ i.len = rawCertLen;
+
+ SECItem *certs[1];
+ certs[0] = &i;
+
+ // For returning
+ CERTCertificate **certArray = NULL;
+
+ /* mp_cert = __CERT_DecodeDERCertificate(&i, PR_TRUE, NULL); */
+ CERT_ImportCerts(CERT_GetDefaultCertDB(), certUsageUserCertImport, 1, certs,
+ &certArray, PR_FALSE, PR_FALSE, NULL);
+ // 1. If you got an compiler error here add into "nss/cert.h" delacarion for
+ // CERT_DecodeDERCertificate() (the same parameters as for __CERT_DecodeDERCertificate())
+ // 2. Since __CERT_DecodeDERCertificate is a private function we might consider using
+ // __CERT_NewTempCertificate() or CERT_ImportCerts() instead.
+
+ // Now map to our cert
+ if (certArray == NULL) {
+ throw XSECCryptoException(XSECCryptoException::X509Error,
+ "NSSX509:loadX509Base64Bin - Error decoding certificate");
+ }
+
+ mp_cert = certArray[0];
- if (mp_cert == 0) {
+ if (mp_cert == 0) {
throw XSECCryptoException(XSECCryptoException::X509Error,
"NSSX509:loadX509Base64Bin - Error decoding certificate");