Import of old SSLeay release: SSLeay 0.9.1b (unreleased)
[openssl.git] / crypto / pkcs7 / sign.c
index ead1cb65cae7a06a38da43d11a7be735e390ea5e..6ad88d468877ce6e6432442861eec2696d7871e1 100644 (file)
@@ -105,7 +105,13 @@ again:
        p7=PKCS7_new();
        PKCS7_set_type(p7,NID_pkcs7_signed);
         
-       if (PKCS7_add_signature(p7,x509,pkey,EVP_sha1()) == NULL) goto err;
+       si=PKCS7_add_signature(p7,x509,pkey,EVP_sha1());
+       if (si == NULL) goto err;
+
+       /* Add some extra attributes */
+       if (!add_signed_time(si)) goto err;
+       if (!add_signed_string(si,"SIGNED STRING")) goto err;
+       if (!add_signed_seq2string(si,"STRING1","STRING2")) goto err;
 
        /* we may want to add more */
        PKCS7_add_certificate(p7,x509);
@@ -125,7 +131,7 @@ again:
                BIO_write(p7bio,buf,i);
                }
 
-       if (!PKCS7_dataSign(p7,p7bio)) goto err;
+       if (!PKCS7_dataFinal(p7,p7bio)) goto err;
        BIO_free(p7bio);
 
        PEM_write_PKCS7(stdout,p7);