Greetings, users.

I am having a strange problem decrypting a file that I used openssl to
encrypt via the following:
openssl enc -bf -in nfoz.tar.gz -out nfoz.tar.gz.bf

If I attempt to decrypt with the following:
openssl enc -d -bf -in nfoz.tar.gz.bf -out nfoz.tar.gz

I get the following message if I type anything but the correct passphrase:
46462:error:06065064:digital envelope routines:EVP_DecryptFinal:bad
decrypt:/usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/evp/evp_enc.c:450:

If I type the correct passphrase, I get this error message:
46489:error:06065064:digital envelope routines:EVP_DecryptFinal:bad
decrypt:/usr/src/secure/lib/libcrypto/../../../crypto/openssl/crypto/evp/evp_enc.c:457:

The line numbers (450 and 457) always seem to be 7 lines apart, depending on
the version of openssl I attempt to decrypt the file with.

The file is -rw-r--r--  1 phiz  www  37081488 May 17 19:01 nfoz.tar.gz.bf

The code in question appears to be this:

if (b > 1)
       {
       if (ctx->buf_len || !ctx->final_used)
               {

EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_WRONG_FINAL_BLOCK_LENGTH);
               return(0);
               }
       OPENSSL_assert(b <= sizeof ctx->final);
       n=ctx->final[b-1];
       if (n == 0 || n > (int)b)
               {
               EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT);
               return(0);
               }
       for (i=0; i<n; i++)
               {
               if (ctx->final[--b] != n)
                       {
                       EVPerr(EVP_F_EVP_DECRYPTFINAL_EX,EVP_R_BAD_DECRYPT);
                       return(0);
                       }
               }
       n=ctx->cipher->block_size-n;
       for (i=0; i<n; i++)
               out[i]=ctx->final[i];
       *outl=n;
       }
else
       *outl=0;
return(1);
}

I am stumped, (and an idiot for not having a good backup).  Any help would
be very appreciated.

Thanks in advance,

Chris

Reply via email to