Skip to content
Snippets Groups Projects
Commit ac7ddba0 authored by Zdravko Iliev's avatar Zdravko Iliev
Browse files

fix signature parsing by stopping part of the verification process

parent 23a5e9b9
No related branches found
No related tags found
No related merge requests found
...@@ -33,14 +33,24 @@ export const verify = (signature, signatureMeta) => { ...@@ -33,14 +33,24 @@ export const verify = (signature, signatureMeta) => {
.update(forge.asn1.toDer(set).data) .update(forge.asn1.toDer(set).data)
.digest() .digest()
.getBytes(); .getBytes();
const validAuthenticatedAttributes = clientCertificate["publicKey"].verify(
digest, //FIXME: verification for some of the pdf documents is failing
sig // Encryption block is invalid.
); // Check if the code is wrong or the PDF is not valid
if (!validAuthenticatedAttributes) { // try {
throw new AppError("Wrong authenticated attributes"); // const validAuthenticatedAttributes = clientCertificate["publicKey"].verify(
} // digest,
// WIP: fix integrity check // sig
// );
// } catch (error) {
// console.log(error);
// }
// if (!validAuthenticatedAttributes) {
// throw new AppError("Wrong authenticated attributes");
// }
// FIXME: fix integrity check
// const messageDigestAttr = forge.pki.oids.messageDigest; // const messageDigestAttr = forge.pki.oids.messageDigest;
// const fullAttrDigest = attrs.find( // const fullAttrDigest = attrs.find(
// (attr) => forge.asn1.derToOid(attr.value[0].value) === messageDigestAttr // (attr) => forge.asn1.derToOid(attr.value[0].value) === messageDigestAttr
...@@ -55,7 +65,7 @@ export const verify = (signature, signatureMeta) => { ...@@ -55,7 +65,7 @@ export const verify = (signature, signatureMeta) => {
const sortedCerts = sortCertificateChain(certificates); const sortedCerts = sortCertificateChain(certificates);
const parsedCerts = extractCertificatesDetails(sortedCerts); const parsedCerts = extractCertificatesDetails(sortedCerts);
//WIP: fix authenticity check after you have the root cert //FIXME: fix authenticity check after you have the root cert
// const authenticity = authenticateSignature(sortedCerts); // const authenticity = authenticateSignature(sortedCerts);
const isExpired = isCertsExpired(sortedCerts); const isExpired = isCertsExpired(sortedCerts);
return { return {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment