in reply to Re: Crypt::OpenPGP blocksize problem
in thread Crypt::OpenPGP blocksize problem

I, Frank, made the original request for help, but for some reason i wasn't actually logged in. Anyway, um, the block above does not help this problem at all. decrypt throws an error that no data packets were found. I utilized the above function by sending my scalar of all the crypt data as the paramter to get16 ( $Data = get16($Data) ). zentara, should the abover function be used in a line by line fashion? or is there a bug in it? I don't really understand what it does. Frank
  • Comment on Re: Re: Crypt::OpenPGP blocksize problem

Replies are listed 'Best First'.
Re: Re: Re: Crypt::OpenPGP blocksize problem
by zentara (Cardinal) on Mar 22, 2004 at 21:21 UTC
    Don't know what your problem actually is. But I remember your error was "data not in block size 16". What the sub does is pad the string with null characters, from 1 to 15 depending, so that the data string is in nice even blocks of 16 bytes. You will see that after you decrypt, the data will be a little bigger because of the padding, but it won't affect the file. If you want to strip the file after decrypting:
    #To strip any padding after decryption: my $plaintext = $cipher->decrypt($encrypted); $plaintext =~ s/^\0+//;
    Why you are not getting the results you want is not known to me. Maybe try posting again with some code?

    I'm not really a human, but I play one on earth. flash japh