Hi. Could anyone help me? I'm obtaining an error
when I try to sign an ASN1
message with PKCS7_sign: /***********************************************************************************/ /*This is the ASN1 message I need to sign*/ ASN1NegotiationRequest *prueba=nr->toASN1Object(); Util *util = new Util();
X509 *certificadoX509 = NULL; /*This read a client certificate and store it in the
variable
certificadoX509 */ int salida = util->leerCertificadoX509("d:\\RafaCerJava.der", &certificadoX509); if (salida != 1 )
printf("Error al leer el certificado %d\n", salida); else printf("Certificado leido con exito\n"); //Obtenemos la clave privada
EVP_PKEY *evpPKey = EVP_PKEY_new(); /*This obtain the private key from a der file, and store it in the
variable
evpPKey*/ salida = util->readPrivateKey("d:\\RafaKeyJava.der",&evpPKey); if (salida != 1)
printf("Error al obtener la clave privada %d\n", salida); else printf("%d\n", *evpPKey); //Certificados adicionales
STACK_OF(X509) *certs; certs = sk_X509_new_null (); //Datos a firmar
BIO *data = ""> int long_ = i2d_ASN1NegotiationRequest(prueba, NULL); int leidos = BIO_write(data, prueba, long_);
BIO_flush(data);
if (leidos <= 0)
printf("Error al obtener el objeto BIO\n"); else printf("Leidos : %d bytes %d\n",leidos, long_); //Entrando a firmar
PKCS7 *signedData = PKCS7_sign(certificadoX509, evpPKey, certs, data, 0); /***********************************************************************************/ Well, I obtain a NULL result from PKCS7_sign, and the reason I get
with
ERR_error_string is : "error:2106906D:PKCS7 routines:PKCS7_dataInit:unknown digest type". Does anyone knows what is happening please?. Thanks a lot |
- RE: Unknown Digest Type Antonio Andrés Espallardo
- RE: Unknown Digest Type Travers, Paul
- Re: Unknown Digest Type Antonio Andrés Espallardo