Commits

Anonymous committed 3124823

tkr37: #i112307# Support for x509 v3 Subject Alternative Name extension added

Comments (0)

Files changed (3)

xmlsecurity/qa/certext/SanCertExt.cxx

 #include "precompiled_xmlsecurity.hxx" 
 #include "sal/config.h"
 
+#ifdef NSS_ENGINE
+#include "../../source/xmlsec/nss/securityenvironment_nssimpl.hxx"
+#else
 #include "../../source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx"
+#endif 
+
 #include <com/sun/star/security/XSanExtension.hpp>
 #include <com/sun/star/security/ExtAltNameType.hpp>
 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
             ne_ssl_certificate* cert = ne_ssl_cert_read("User_35_Root_11.crt");
             char* certExportB64 = ne_ssl_cert_export(cert);
 
-            uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv( new SecurityEnvironment_MSCryptImpl( uno::Reference< XMultiServiceFactory >() ) );
-            
+#ifdef NSS_ENGINE
+	    uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv(
+		new SecurityEnvironment_NssImpl(uno::Reference< XMultiServiceFactory >()) );
+#else
+	    uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv( 
+	        new SecurityEnvironment_MSCryptImpl( uno::Reference< XMultiServiceFactory>() ) );
+#endif   
             uno::Reference< security::XCertificate > xCert = xSecurityEnv->createCertificateFromAscii( 
                 rtl::OStringToOUString( certExportB64, RTL_TEXTENCODING_ASCII_US ) );
 

xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx

         return length;
     }
 
-    static SECStatus DestroyGeneralName(CERTGeneralName *name)
-    {
-        CERTGeneralName    *first;
-        CERTGeneralName    *next = NULL;
-
-        first = name;
-        do {
-            next = CERT_GetNextGeneralName(name);
-            PORT_Free(name);
-            name = next;
-        } while (name != first);
-        return SECSuccess;
-
-    }
 }
 
 //Methods from XSanExtension
                 case certX400Address: {
                     // unsupported
                     arrCertAltNameEntry[i].Type = ExtAltNameType_X400_ADDRESS;
-                    arrCertAltNameEntry[i].value <<= Any.VOID;
                     break;
                                       }
                 case certDirectoryName: {
                 case certEDIPartyName:  {
                     // unsupported
                     arrCertAltNameEntry[i].Type = ExtAltNameType_EDI_PARTY_NAME;
-                    arrCertAltNameEntry[i].Value <<= Any.VOID;
                     break;
                                         }
                 case certURI:

xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx

             ::rtl::OString oidString(CERT_GetOidString(&id));
             
             // remove "OID." prefix if existing
-            ::rtl::OString objID;
+            ::rtl::OString objId;
             ::rtl::OString oid("OID.");
             if (oidString.match(oid))
-                objID = oidString.copy(oid.getLength());
+                objId = oidString.copy(oid.getLength());
             else
-                objID = oidString;
+                objId = oidString;
 
             if ( objId.equals("2.5.29.17") )
                 pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ;