generalpiston / typeorm-encrypted

Encrypted field for typeorm.
MIT License
74 stars 19 forks source link

not works with aes-256-gcm #21

Closed Paul75 closed 4 years ago

Paul75 commented 4 years ago

Hello,

I do :

export const MyEncryptionTransformerConfig = {
    key: 'e41c966f21f9e1577802463f8924e6a3fe3e9751f201304213b2f845d8841d61',
    algorithm: 'aes-256-gcm',
    ivLength: 16,
};

It encrypt but when I would display if failed..... Error : Unsupported state or unable to authenticate data

Thanks

generalpiston commented 4 years ago

I think the tag data needs to be added for GCM to work appropriately: https://gist.github.com/rjz/15baffeab434b8125ca4d783f4116d81. Looks like most people append it to the cipher text: https://crypto.stackexchange.com/questions/25249/where-is-the-authentication-tag-stored-in-file-encrypted-using-aes-gcm.

@Paul75 good find... will send a patch soon.

Paul75 commented 4 years ago

Hello,

Can I see when the patch ? Because I must decide now to use with my project rapidly.... Because also I must take time to test performance.

Thanks

generalpiston commented 4 years ago

@Paul75 see https://github.com/generalpiston/typeorm-encrypted/commit/20da54d456fc875cf8bf20ba14ec930567d9466e.

generalpiston commented 4 years ago

@Paul75 should be available in 0.5.5.