]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/rsa: explain random parameter for GenerateKey and GenerateMultiPrimeKey.
authorShenghou Ma <minux.ma@gmail.com>
Thu, 13 Feb 2014 20:56:48 +0000 (15:56 -0500)
committerShenghou Ma <minux.ma@gmail.com>
Thu, 13 Feb 2014 20:56:48 +0000 (15:56 -0500)
Fixes #6850.

LGTM=agl
R=golang-codereviews, agl
CC=golang-codereviews
https://golang.org/cl/60500046

src/pkg/crypto/rsa/rsa.go

index c7353ea311aadc87c15c756b86073187a507e458..c8f1febe64705e2306c794036c7c64045d371050 100644 (file)
@@ -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.
 //