only use X509Data
Change-Id: I52e6588f5fac04bb26d77c1f3af470db73e41f72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127193 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
committed by
Miklos Vajna
parent
6485187c53
commit
be446d81e0
@@ -42,6 +42,10 @@
|
||||
#include <xmlsec/nss/app.h>
|
||||
#include <xmlsec/nss/crypto.h>
|
||||
#include <xmlsec/nss/pkikeys.h>
|
||||
#include <xmlsec/nss/x509.h>
|
||||
#endif
|
||||
#ifdef XMLSEC_CRYPTO_MSCRYPTO
|
||||
#include <xmlsec/mscng/x509.h>
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -233,6 +233,10 @@ SAL_CALL XMLSignature_MSCryptImpl::validate(
|
||||
// We do certificate verification ourselves.
|
||||
pDsigCtx->keyInfoReadCtx.flags |= XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
|
||||
|
||||
// limit possible key data to valid X509 certificates only, no KeyValues
|
||||
if (xmlSecPtrListAdd(&(pDsigCtx->keyInfoReadCtx.enabledKeyData), BAD_CAST xmlSecMSCngKeyDataX509GetKlass()) < 0)
|
||||
throw RuntimeException("failed to limit allowed key data");
|
||||
|
||||
//Verify signature
|
||||
//The documentation says that the signature is only valid if the return value is 0 (that is, not < 0)
|
||||
//AND pDsigCtx->status == xmlSecDSigStatusSucceeded. That is, we must not make any assumptions, if
|
||||
|
@@ -239,6 +239,10 @@ SAL_CALL XMLSignature_NssImpl::validate(
|
||||
// We do certificate verification ourselves.
|
||||
pDsigCtx->keyInfoReadCtx.flags |= XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
|
||||
|
||||
// limit possible key data to valid X509 certificates only, no KeyValues
|
||||
if (xmlSecPtrListAdd(&(pDsigCtx->keyInfoReadCtx.enabledKeyData), BAD_CAST xmlSecNssKeyDataX509GetKlass()) < 0)
|
||||
throw RuntimeException("failed to limit allowed key data");
|
||||
|
||||
//Verify signature
|
||||
int rs = xmlSecDSigCtxVerify( pDsigCtx.get() , pNode );
|
||||
|
||||
|
Reference in New Issue
Block a user