PrivateKey Decrypt Failure

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

 



Hi,

I am using openssl 1.1.1b and I am storing private key encrypted.

I am storing private key as
PEM_write_bio_PrivateKey(bio, pkey, EVP_aes_128_cbc(), PKeyPassPKCS12, 0, 0, NULL); 
and on system startup reading using the following way
 if(!PEM_read_bio_PrivateKey(keyBIO, &user_s_key, NULL, decryptSharedSecret))

Upon debugging I found it is failing in PKCS12_pbe_crypt > EVP_CipherFinal_ex
Please suggest where I am doing wrong?
Could this be appear to related to padding ? 
Without encryption of key , it works fine , which clear other code is all fine.

Thanks,

evp_enc.c:EVP_DecryptFinal_ex:569
/*
         * The following assumes that the ciphertext has been authenticated.
         * Otherwise it provides a padding oracle.
         */
        n = ctx->final[b - 1];
        if (n == 0 || n > (int)b) {
            EVPerr(EVP_F_EVP_DECRYPTFINAL_EX, EVP_R_BAD_DECRYPT);
            return 0;
        }

[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