From: Shenghou Ma Date: Thu, 13 Feb 2014 20:56:48 +0000 (-0500) Subject: crypto/rsa: explain random parameter for GenerateKey and GenerateMultiPrimeKey. X-Git-Tag: go1.3beta1~718 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9abe6d9dd0ee46b696f8c261417444777af19f6e;p=gostls13.git 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 --- diff --git a/src/pkg/crypto/rsa/rsa.go b/src/pkg/crypto/rsa/rsa.go index c7353ea311..c8f1febe64 100644 --- a/src/pkg/crypto/rsa/rsa.go +++ b/src/pkg/crypto/rsa/rsa.go @@ -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. //