Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate key "Invalid key length" #23

Closed
Paul75 opened this issue Jul 4, 2020 · 2 comments
Closed

generate key "Invalid key length" #23

Paul75 opened this issue Jul 4, 2020 · 2 comments

Comments

@Paul75
Copy link

Paul75 commented Jul 4, 2020

Hello,

When I generate key I see error : "Invalid key length"

I do for exemple :

export const MyEncryptionTransformerConfig = {
    key: Buffer.from(env.app.crypto.key, 'utf8').toString('base64'),
    algorithm: env.app.crypto.algorithm,
    ivLength: 16,
};

In env I add :
env.app.crypto.key = nCM*R$izc*G3vqg7jo086mbc9Rg^7NYl

Thanks

@Paul75 Paul75 changed the title generate key generate key "Invalid key length" Jul 4, 2020
@Paul75
Copy link
Author

Paul75 commented Jul 4, 2020

Helllo,

Ok I see thant must generate key like :

const Crypto = require('crypto');
           return Crypto.randomBytes(32)
               .toString('hex')
               ;

Thanks

@Paul75 Paul75 closed this as completed Jul 4, 2020
@generalpiston
Copy link
Owner

generalpiston commented Jul 4, 2020

@Paul75 there are a lot of ways to generate keys...

Perhaps we should add this to the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants