Re: Symmetric encryption sample code

William Welliver <[email protected]> Wed, 1 May 2019 10:08:09 -0400 (EDT)
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Hi Bertrand (and Grubba)-

Well, I was able to confirm that at least one other implementation was 
able to decrypt (and of course, we know that Pike’s SSL works just fine).

Here’s a javascript decrypt snippet that works:

https://bitbucket.org/snippets/hww3/6eMpzq

Against this code to encrypt:

https://bitbucket.org/snippets/hww3/keXgz6

Note that I switched to CBC mode, which is better, but also note that this 
code doesn’t set a proper IV so shouldn’t be considered completely secure.

Bill


On Wed, 1 May 2019, Bertrand LUPART - Linkeo.com wrote:

> 
>
>       On 1 May 2019, at 02:27, H. William Welliver III
>       <[email protected]> wrote:
> 
> So, you are seeing that cryptography is hard… it’s not as simple as
> saying, “decrypt this using AES”. There are a fairly large number of
> parameters that you’d need to specify and most tools aren’t that
> flexible. A solution for you might involve providing a decryption
> program configured using the same parameters that you use to encrypt. 
> It’s hard to know what the problem here is, as the source isn’t
> available. There are a number of things that can affect whether
> encryption and decryption will work: how the key is specified (we
> provide it as a series of n bytes, but a lot of tools assume a key is
> an ascii string and expand it to the correct number of bytes), etc. 
> I was able to get the encrypted result from [1] to work with the
> example decryptor I sent. I was /unable/ to get the encrypted output
> to work with the same tool regardless of whether I used ECB or CBC,
> with an error of “final block not properly padded”.  I am assuming
> that the Buffer pads according to either ISO 10126 or the like; it’s
> unclear what the various online decryptors expect.
> 
> Perhaps there’s something in the Crypto.PGP support that could be a
> short-cut for you?
> 
> Bill
> 
> [1] https://www.devglan.com/online-tools/aes-encryption-decryption
> 
> 
> 
> Hell, yeah. What are the details of the default parameters of Pike's AES? Is
> that possible to change that?
> 
> I'd be more comfortable if i could decipher my own data using a mainstream
> language. I need to be confident about the data sent before asking the
> another party to decipher it.
> 
> I'll give Java a try for AES first, then PGP could be good alternative path.
> 
> 
> Thank you,
> 
> -- 
> Bertrand LUPART
> 
> 
>