mirror of
https://github.com/LibreOffice/core.git
synced 2025-07-22 01:09:00 +00:00
sync mscrypt impl with nss impl
Change-Id: I4960f4b8fa1124f98ee2004ffcfc0994916c297e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142335 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@ -41,6 +41,7 @@
|
||||
|
||||
#include <biginteger.hxx>
|
||||
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include <comphelper/windowserrorstring.hxx>
|
||||
#include <sal/log.hxx>
|
||||
#include <rtl/locale.h>
|
||||
@ -700,26 +701,25 @@ uno::Reference< XCertificate > SecurityEnvironment_MSCryptImpl::createCertificat
|
||||
return xcert ;
|
||||
}
|
||||
|
||||
uno::Reference< XCertificate > SecurityEnvironment_MSCryptImpl::createCertificateFromAscii( const OUString& asciiCertificate ) {
|
||||
|
||||
uno::Reference< XCertificate > SecurityEnvironment_MSCryptImpl::createCertificateFromAscii( const OUString& asciiCertificate )
|
||||
{
|
||||
OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ;
|
||||
|
||||
xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), static_cast<int>(oscert.getLength()) ) ;
|
||||
|
||||
xmlSecSize certSize;
|
||||
xmlSecBase64Decode_ex( chCert, chCert, xmlStrlen( chCert ), &certSize ) ;
|
||||
int nRet = xmlSecBase64Decode_ex( chCert, reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ), &certSize ) ;
|
||||
if (nRet < 0 || certSize == 0)
|
||||
{
|
||||
xmlFree(chCert);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uno::Sequence< sal_Int8 > rawCert( certSize ) ;
|
||||
auto rawCertRange = asNonConstRange(rawCert);
|
||||
for( xmlSecSize i = 0 ; i < certSize ; i ++ )
|
||||
rawCertRange[i] = *( chCert + i ) ;
|
||||
uno::Sequence<sal_Int8> rawCert(comphelper::arrayToSequence<sal_Int8>(chCert, certSize));
|
||||
|
||||
xmlFree( chCert ) ;
|
||||
|
||||
return createCertificateFromRaw( rawCert ) ;
|
||||
}
|
||||
|
||||
|
||||
static HCERTSTORE getCertStoreForIntermediatCerts(
|
||||
const uno::Sequence< uno::Reference< css::security::XCertificate > >& seqCerts)
|
||||
{
|
||||
|
Reference in New Issue
Block a user