|
30 | 30 | // with a key smaller than 1024 bits. Such keys are insecure and should not be
|
31 | 31 | // used.
|
32 | 32 | //
|
33 |
| -// The `rsa1024min=0` GODEBUG setting suppresses this error, but we recommend |
34 |
| -// doing so only in tests, if necessary. Tests can use [testing.T.Setenv] or |
35 |
| -// include `//go:debug rsa1024min=0` in a `_test.go` source file to set it. |
| 33 | +// The rsa1024min=0 GODEBUG setting suppresses this error, but we recommend |
| 34 | +// doing so only in tests, if necessary. Tests can set this option using |
| 35 | +// [testing.T.Setenv] or by including "//go:debug rsa1024min=0" in a *_test.go |
| 36 | +// source file. |
36 | 37 | //
|
37 | 38 | // Alternatively, see the [GenerateKey (TestKey)] example for a pregenerated
|
38 | 39 | // test-only 2048-bit key.
|
39 | 40 | //
|
40 |
| -// [GenerateKey (TestKey)]: #example-GenerateKey-TestKey |
| 41 | +// [GenerateKey (TestKey)]: https://pkg.go.dev/crypto/rsa#example-GenerateKey-TestKey |
41 | 42 | package rsa
|
42 | 43 |
|
43 | 44 | import (
|
@@ -226,7 +227,7 @@ type CRTValue struct {
|
226 | 227 | // Validate performs basic sanity checks on the key.
|
227 | 228 | // It returns nil if the key is valid, or else an error describing a problem.
|
228 | 229 | //
|
229 |
| -// It runs faster on valid keys if run after [Precompute]. |
| 230 | +// It runs faster on valid keys if run after [PrivateKey.Precompute]. |
230 | 231 | func (priv *PrivateKey) Validate() error {
|
231 | 232 | // We can operate on keys based on d alone, but it isn't possible to encode
|
232 | 233 | // with [crypto/x509.MarshalPKCS1PrivateKey], which unfortunately doesn't
|
@@ -274,7 +275,7 @@ func checkPublicKeySize(k *PublicKey) error {
|
274 | 275 | // returned key does not depend deterministically on the bytes read from rand,
|
275 | 276 | // and may change between calls and/or between versions.
|
276 | 277 | //
|
277 |
| -// [Minimum key size]: #hdr-Minimum_key_size |
| 278 | +// [Minimum key size]: https://pkg.go.dev/crypto/rsa#hdr-Minimum_key_size |
278 | 279 | func GenerateKey(random io.Reader, bits int) (*PrivateKey, error) {
|
279 | 280 | if err := checkKeySize(bits); err != nil {
|
280 | 281 | return nil, err
|
|
0 commit comments