-
Notifications
You must be signed in to change notification settings - Fork 0
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
Remove ECDSA and Denom dependencies #7
Conversation
return ecdsa.GenerateKey(secp256k1.S256(), rand.Reader) | ||
// GenerateKey generates a new private bytes object used to dervie the keypair. | ||
func GenerateKey() *[]byte { | ||
result := []byte(time.Now().String()) |
Check warning
Code scanning / CodeQL
Calling the system time Warning test
pkg/encryption/aes.go
Outdated
|
||
// Use a SHA-256 hash of the denom string as the salt | ||
salt := sha256.Sum256([]byte(denom)) | ||
salt := sha256.Sum256([]byte("aes key derivation salt")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, if making salt effectively global, makes key generation less secure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, this actually doesn't actually add any security. Replaced to nil.
In our case we are going to pass the hashed, then signed denom as the privateBytes, so I think it should be good enough.
Added a comment to explain that the user is responsible for ensuring that the secret passed in (privateBytes) are salted or hashed beforehand.
This library is meant to be a general purpose cryptography library.
Currently we generate keys based on ecdsa private keys, and denoms, which are things that are specific to the use case of the CT Module we are building. However, those should not be the concerns of this library.
This allows the library to be used more flexibly without having a dependency on private keys and denoms.