Commit 9abe6d9d authored by Shenghou Ma's avatar Shenghou Ma

crypto/rsa: explain random parameter for GenerateKey and GenerateMultiPrimeKey.

Fixes #6850.

LGTM=agl
R=golang-codereviews, agl
CC=golang-codereviews
https://golang.org/cl/60500046
parent c36dd4ab
......@@ -120,16 +120,18 @@ func (priv *PrivateKey) Validate() error {
return nil
}
// GenerateKey generates an RSA keypair of the given bit size.
// GenerateKey generates an RSA keypair of the given bit size using the
// random source random (for example, crypto/rand.Reader).
func GenerateKey(random io.Reader, bits int) (priv *PrivateKey, err error) {
return GenerateMultiPrimeKey(random, 2, bits)
}
// GenerateMultiPrimeKey generates a multi-prime RSA keypair of the given bit
// size, as suggested in [1]. Although the public keys are compatible
// (actually, indistinguishable) from the 2-prime case, the private keys are
// not. Thus it may not be possible to export multi-prime private keys in
// certain formats or to subsequently import them into other code.
// size and the given random source, as suggested in [1]. Although the public
// keys are compatible (actually, indistinguishable) from the 2-prime case,
// the private keys are not. Thus it may not be possible to export multi-prime
// private keys in certain formats or to subsequently import them into other
// code.
//
// Table 1 in [2] suggests maximum numbers of primes for a given size.
//
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment