phppkiasn.1pkcs#7xml-dsig

Create a correct PKCS7/CMS (ASN.1) from existing XML Signature in PHP


I have an XML digital signature, (xmlns="http://www.w3.org/2000/09/xmldsig) and I want to convert this into a PKCS7 signature.

I belive I have to use an ASN.1 encoder such as https://github.com/FGrosse/PHPASN1 but I cannot understand how to create a valid pkcs7/asn.1 signaure with it.

Is this possible?


Solution

  • No. It's not posible.

    When making a XML signature, the private key is signing a data codification (codified in XML).

    You are able to put the information included in this XML signature into a PKCS7 signature (codified in ASN.1). But then, the codification of these data would be different, so the signature wouldn't be valid.