I am looking to see if using a digital signature is a secure and reasonable way to generate a key for AES encryption.
To flow would be as follows:
A user signs a message m
with their private key. They actually sign the hash of m
but this is taken care of as part of the digital signature creation function. This returns the digital signature s
.
Provided s
remains secret, is s
a secure digest to use in order to create a key k
for AES.
They key k
will be created as follows:
const crypto = require('crypto');
crypto.scrypt(s, 'unique-salt', keyLength, (err, key) => {
console.log(key.toString('hex')); // 12dd454fb...
});
Where the first parameter of the function s
is the digital signature created by the user.
The documentation for the Node crypto package doesn't specific any requirements for this parameter.
I understand that if the digital signature is obtained by someone else then that person can decrypt and encrypt messages, however the same can be said if that person obtains whatever string is used as that parameter.
So the two questions are:
Is this a secure and suitable way to generate a key for AES? Assuming that digital signatures are unique and difficult to guess by people who do not have access to the private key. And assuming that the digital signature used to create the key is kept private.
Is the security dependent on the message
m
that is signed? Does this need to be kept secret also? My assumption is that is does not matter the what the message is as even if mallet knows this message they cannot create the correct digital signature as they do not have the private key.
Thank you