mirror of
https://github.com/golang/go
synced 2024-11-12 07:00:21 -07:00
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
This commit is contained in:
parent
c36dd4abdc
commit
9abe6d9dd0
@ -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.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user