diff options
author | beck <> | 1999-09-29 04:37:45 +0000 |
---|---|---|
committer | beck <> | 1999-09-29 04:37:45 +0000 |
commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/pkcs7/sign.c | |
parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/pkcs7/sign.c')
-rw-r--r-- | src/lib/libcrypto/pkcs7/sign.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/lib/libcrypto/pkcs7/sign.c b/src/lib/libcrypto/pkcs7/sign.c index ead1cb65ca..d5f1154006 100644 --- a/src/lib/libcrypto/pkcs7/sign.c +++ b/src/lib/libcrypto/pkcs7/sign.c | |||
@@ -56,23 +56,23 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | #include <stdio.h> | 58 | #include <stdio.h> |
59 | #include "bio.h" | 59 | #include <openssl/bio.h> |
60 | #include "x509.h" | 60 | #include <openssl/x509.h> |
61 | #include "pem.h" | 61 | #include <openssl/pem.h> |
62 | #include <openssl/err.h> | ||
62 | 63 | ||
63 | main(argc,argv) | 64 | int main(argc,argv) |
64 | int argc; | 65 | int argc; |
65 | char *argv[]; | 66 | char *argv[]; |
66 | { | 67 | { |
67 | X509 *x509; | 68 | X509 *x509; |
68 | EVP_PKEY *pkey; | 69 | EVP_PKEY *pkey; |
69 | PKCS7 *p7; | 70 | PKCS7 *p7; |
70 | PKCS7 *p7_data; | ||
71 | PKCS7_SIGNER_INFO *si; | 71 | PKCS7_SIGNER_INFO *si; |
72 | BIO *in; | 72 | BIO *in; |
73 | BIO *data,*p7bio; | 73 | BIO *data,*p7bio; |
74 | char buf[1024*4]; | 74 | char buf[1024*4]; |
75 | int i,j; | 75 | int i; |
76 | int nodetach=0; | 76 | int nodetach=0; |
77 | 77 | ||
78 | EVP_add_digest(EVP_md2()); | 78 | EVP_add_digest(EVP_md2()); |
@@ -105,7 +105,12 @@ again: | |||
105 | p7=PKCS7_new(); | 105 | p7=PKCS7_new(); |
106 | PKCS7_set_type(p7,NID_pkcs7_signed); | 106 | PKCS7_set_type(p7,NID_pkcs7_signed); |
107 | 107 | ||
108 | if (PKCS7_add_signature(p7,x509,pkey,EVP_sha1()) == NULL) goto err; | 108 | si=PKCS7_add_signature(p7,x509,pkey,EVP_sha1()); |
109 | if (si == NULL) goto err; | ||
110 | |||
111 | /* If you do this then you get signing time automatically added */ | ||
112 | PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT, | ||
113 | OBJ_nid2obj(NID_pkcs7_data)); | ||
109 | 114 | ||
110 | /* we may want to add more */ | 115 | /* we may want to add more */ |
111 | PKCS7_add_certificate(p7,x509); | 116 | PKCS7_add_certificate(p7,x509); |
@@ -125,7 +130,7 @@ again: | |||
125 | BIO_write(p7bio,buf,i); | 130 | BIO_write(p7bio,buf,i); |
126 | } | 131 | } |
127 | 132 | ||
128 | if (!PKCS7_dataSign(p7,p7bio)) goto err; | 133 | if (!PKCS7_dataFinal(p7,p7bio)) goto err; |
129 | BIO_free(p7bio); | 134 | BIO_free(p7bio); |
130 | 135 | ||
131 | PEM_write_PKCS7(stdout,p7); | 136 | PEM_write_PKCS7(stdout,p7); |