Error code 554184855 on PKCS7_sign_add_signer?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everyone, I've been reading smime.c and trying to work my way up from a command that does work.
However, I've reached this stage, and I get an error code I don-t know how to diagnose.
The source is this(BEWARE: very little error handling, this is just a first informed attempt at the problem):
    X509 * certificado = NULL;
    FILE * archivoCertificado = NULL;
    archivoCertificado = fopen("cert.crt","rb");
    if (!archivoCertificado) {
        qDebug() << "Fallo abrir el archivo del certificado";
        return;
    }
    PEM_read_X509(archivoCertificado,&certificado,NULL,NULL);
    if (!certificado) {
        qDebug() << "Fallo al generar la estructura X509";
        return;
    }
    FILE* archivoLlave = NULL;
    archivoLlave = fopen("key.key","rb");
    EVP_PKEY * llave;
    PEM_read_PrivateKey(archivoLlave,&llave,NULL,NULL);
    if (!llave) {
        qDebug() << "Fallo la lectura de la llave";
        return;
    }
    BIO * datos = NULL;
    FILE * fDatos = NULL;
    fDatos = fopen("Prueba.xml","rb");
    if (!fDatos) {
        qDebug() << "Fallo la apertura del archivo de prueba.";
        return;
    }
    datos = BIO_new_fp(fDatos,NULL);
    if (!datos) {
        qDebug() << "Error al leer el archivo de prueba.xml";
        return;
    }
    PKCS7 *estructura = NULL;
    if (!PKCS7_sign_add_signer(estructura,certificado,llave,NULL,0)) {
        qDebug() << "PKCS7_sign_add_signer fallo:" << ERR_get_error();
        return;
    }
    estructura = PKCS7_sign(certificado,llave,NULL,datos,PKCS7_TEXT);
    if (!estructura) {
        qDebug() << "Fallo la creacion de la estructura.";
        return;
    }

Failure comes at PKCS7_sign_add_signer..
Sorry for the main language used in the code, let me know if its of best practices to keep it to english or if it wouldn't be a real issue for the time being.

Kind regards,
Anibal.-
-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux