Add CMS_SignerInfo_get0_signature function.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 7 Nov 2013 03:55:49 +0000 (03:55 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 9 Nov 2013 15:09:22 +0000 (15:09 +0000)
Add function to retrieve the signature from a CMS_SignerInfo structure:
applications can then read or modify it.
(cherry picked from commit e8df6cec4c09b9a94c4c07abcf0402d31ec82cc1)

crypto/cms/cms.h
crypto/cms/cms_sd.c
doc/crypto/CMS_get0_SignerInfos.pod

index 8b1d29f0c1614d39f32250d13e75d8d1dd1d4527..4b36a69c4f2981a690535b737f60d8758774dce5 100644 (file)
@@ -275,6 +275,7 @@ int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
                                        unsigned int flags);
 void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer,
                                        X509_ALGOR **pdig, X509_ALGOR **psig);
+ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
 int CMS_SignerInfo_sign(CMS_SignerInfo *si);
 int CMS_SignerInfo_verify(CMS_SignerInfo *si);
 int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
index 16bdaf890d6f302aa07515a8949f7ea92adea3dc..28ce6a7639e5b0de8a2ba2da36a2520bc69033fe 100644 (file)
@@ -616,6 +616,11 @@ void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer,
                *psig = si->signatureAlgorithm;
        }
 
+ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si)
+       {
+       return si->signature;
+       }
+
 static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms,
                                        CMS_SignerInfo *si, BIO *chain)
        {
index 47f6d2a04726bf296d7764cdbcacbee1a9b37f58..b46c0e07ab3dac72fa435bc6dec2d7f7aeeb06b8 100644 (file)
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
- CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_cert_cmp, CMS_set1_signer_certs - CMS signedData signer functions.
+CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_get0_signature, CMS_SignerInfo_cert_cmp, CMS_set1_signer_cert - CMS signedData signer functions.
 
 =head1 SYNOPSIS
 
@@ -11,6 +11,7 @@
  STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
 
  int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
+ ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
  int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
  void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
 
@@ -24,6 +25,11 @@ associated with a specific CMS_SignerInfo structure B<si>. Either the
 keyidentifier will be set in B<keyid> or B<both> issuer name and serial number
 in B<issuer> and B<sno>.
 
+CMS_SignerInfo_get0_signature() retrieves the signature associated with 
+B<si> in a pointer to an ASN1_OCTET_STRING structure. This pointer returned
+corresponds to the internal signature value if B<si> so it may be read or
+modified.
+
 CMS_SignerInfo_cert_cmp() compares the certificate B<cert> against the signer
 identifier B<si>. It returns zero if the comparison is successful and non zero
 if not.