Trust certificate authority per firma digitale

If you try to verify the signature of a p7m file without the Certification Authority (la CA), the verification fails ("unable to load certificate") because we do not have CA trust certificates (so-called Trusts).
These Certificate Authorities have been defined by Italian law and are registered on the CNIPA, which since December 2009 has become DigitPA, as a certificate of XML certificates and found them on the same site at

To have openssl manage them you have to put them in its format so:

wget -O - | perl -ne 'if (/<X509Certificate>/) {
s/^\s+//; s/\s+$//;
print "-----BEGIN CERTIFICATE-----\n";
while (length($_)>64) {
print substr($_,0,64)."\n";
print $_."\n";
print "-----END CERTIFICATE-----\n";
}' >CA.pem

This way we have all the certificates in a single CA.pem file, unfortunately even those that may have expired. Even if it's over, we may need to check out an old file so we can also serve the expiration.
For more information, see the article

For script updates, please visit

Leave a Reply

Your email address will not be published. Required fields are marked *

89 − = 88