X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fpkcs7%2Fsign.c;h=61dc2b187e14da29f03570b7fbb717bb10bb4c0d;hb=27ad06a62735702b9702a605086b155a20557c5f;hp=6ad88d468877ce6e6432442861eec2696d7871e1;hpb=31b8d8684441e6cd5138832bb1b2ddb10acd6ba6;p=oweals%2Fopenssl.git diff --git a/crypto/pkcs7/sign.c b/crypto/pkcs7/sign.c index 6ad88d4688..61dc2b187e 100644 --- a/crypto/pkcs7/sign.c +++ b/crypto/pkcs7/sign.c @@ -56,23 +56,23 @@ * [including the GNU Public Licence.] */ #include -#include "bio.h" -#include "x509.h" -#include "pem.h" +#include +#include +#include +#include -main(argc,argv) +int main(argc,argv) int argc; char *argv[]; { X509 *x509; EVP_PKEY *pkey; PKCS7 *p7; - PKCS7 *p7_data; PKCS7_SIGNER_INFO *si; BIO *in; BIO *data,*p7bio; char buf[1024*4]; - int i,j; + int i; int nodetach=0; EVP_add_digest(EVP_md2()); @@ -97,9 +97,9 @@ again: BIO_set_fp(data,stdin,BIO_NOCLOSE); if ((in=BIO_new_file("server.pem","r")) == NULL) goto err; - if ((x509=PEM_read_bio_X509(in,NULL,NULL)) == NULL) goto err; + if ((x509=PEM_read_bio_X509(in,NULL,NULL,NULL)) == NULL) goto err; BIO_reset(in); - if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL)) == NULL) goto err; + if ((pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL)) == NULL) goto err; BIO_free(in); p7=PKCS7_new(); @@ -108,10 +108,9 @@ again: 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; + /* If you do this then you get signing time automatically added */ + PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT, + OBJ_nid2obj(NID_pkcs7_data)); /* we may want to add more */ PKCS7_add_certificate(p7,x509);