#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <openssl/pkcs7.h>
#include <openssl/asn1_mac.h>
+#include <openssl/x509.h>
int add_signed_time(PKCS7_SIGNER_INFO *si)
{
signed_string_nid=
OBJ_create("1.2.3.4.5","OID_example","Our example OID");
os=ASN1_OCTET_STRING_new();
- ASN1_OCTET_STRING_set(os,str,strlen(str));
+ ASN1_OCTET_STRING_set(os,(unsigned char*)str,strlen(str));
/* When we add, we do not free */
PKCS7_add_signed_attribute(si,signed_string_nid,
V_ASN1_OCTET_STRING,(char *)os);
return(0);
}
-static signed_seq2string_nid= -1;
+static int signed_seq2string_nid= -1;
/* ########################################### */
int add_signed_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char *str2)
{
os1=ASN1_OCTET_STRING_new();
os2=ASN1_OCTET_STRING_new();
- ASN1_OCTET_STRING_set(os1,str1,strlen(str1));
- ASN1_OCTET_STRING_set(os2,str1,strlen(str1));
+ ASN1_OCTET_STRING_set(os1,(unsigned char*)str1,strlen(str1));
+ ASN1_OCTET_STRING_set(os2,(unsigned char*)str1,strlen(str1));
i =i2d_ASN1_OCTET_STRING(os1,NULL);
i+=i2d_ASN1_OCTET_STRING(os2,NULL);
total=ASN1_object_size(1,i,V_ASN1_SEQUENCE);
so=PKCS7_get_signed_attribute(si,signed_seq2string_nid);
if (so && (so->type == V_ASN1_SEQUENCE))
{
- ASN1_CTX c;
+ ASN1_const_CTX c;
ASN1_STRING *s;
long length;
ASN1_OCTET_STRING *os1,*os2;
goto err;
c.slen-=(c.p-c.q);
- if (!asn1_Finish(&c)) goto err;
+ if (!asn1_const_Finish(&c)) goto err;
*str1=malloc(os1->length+1);
*str2=malloc(os2->length+1);
memcpy(*str1,os1->data,os1->length);
signed_string_nid=
OBJ_create("1.2.3.4.5","OID_example","Our example OID");
os=ASN1_OCTET_STRING_new();
- ASN1_OCTET_STRING_set(os,str,strlen(str));
+ ASN1_OCTET_STRING_set(os,(unsigned char*)str,strlen(str));
/* When we add, we do not free */
ret=X509_ATTRIBUTE_create(signed_string_nid,
V_ASN1_OCTET_STRING,(char *)os);
os1=ASN1_OCTET_STRING_new();
os2=ASN1_OCTET_STRING_new();
- ASN1_OCTET_STRING_set(os1,str1,strlen(str1));
- ASN1_OCTET_STRING_set(os2,str1,strlen(str1));
+ ASN1_OCTET_STRING_set(os1,(unsigned char*)str1,strlen(str1));
+ ASN1_OCTET_STRING_set(os2,(unsigned char*)str1,strlen(str1));
i =i2d_ASN1_OCTET_STRING(os1,NULL);
i+=i2d_ASN1_OCTET_STRING(os2,NULL);
total=ASN1_object_size(1,i,V_ASN1_SEQUENCE);
so=PKCS7_get_signed_attribute(&si,signed_seq2string_nid);
if (so->type == V_ASN1_SEQUENCE)
{
- ASN1_CTX c;
+ ASN1_const_CTX c;
ASN1_STRING *s;
long length;
ASN1_OCTET_STRING *os1,*os2;
goto err;
c.slen-=(c.p-c.q);
- if (!asn1_Finish(&c)) goto err;
+ if (!asn1_const_Finish(&c)) goto err;
*str1=malloc(os1->length+1);
*str2=malloc(os2->length+1);
memcpy(*str1,os1->data,os1->length);