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

Condition DRNG on type of output. #2

Merged
merged 2 commits into from
Nov 29, 2016
Merged

Condition DRNG on type of output. #2

merged 2 commits into from
Nov 29, 2016

Conversation

Bren2010
Copy link
Contributor

Right now, for example, learning an ECDSA private key for a realm leaks information about passwords/RSA private keys for the same realm.

}

gen := &KeyGen{rng}
return gen.GeneratePassword(spec)
}

func GetKey(password, realm string, seed []byte, keyType int, allowUnsafe bool) (crypto.PrivateKey, error) {
rng, err := GetRaw(password, realm, seed, allowUnsafe)
rng, err := getReader(password, realm+fmt.Sprintf("-key(%v)", keyType), seed, allowUnsafe)
Copy link
Contributor

@ignatk ignatk Nov 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should try to map back to a string key type rather than to internal int number here. What if in the future we might want to have alternative implementations in other languages, which may internally interpret key type enum differently?

Maybe somehow reuse https://github.com/cloudflare/gokey/blob/master/cmd/gokey/main.go#L31-L36 or put it lower in the stack, so this function can access defined string literals.

@ignatk ignatk merged commit 63cb69d into cloudflare:master Nov 29, 2016
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

Successfully merging this pull request may close these issues.

2 participants