mirror of
https://github.com/golang/go.git
synced 2025-10-19 19:13:18 +00:00
crypto/rsa: fix documentation formatting
Change-Id: I6a6a696422f9ab73b9ddee131b17d3c177fefc4e Reviewed-on: https://go-review.googlesource.com/c/go/+/687615 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Filippo Valsorda <filippo@golang.org>
This commit is contained in:
parent
4bc3373c8e
commit
1ca23682dd
1 changed files with 7 additions and 6 deletions
|
@ -30,14 +30,15 @@
|
||||||
// with a key smaller than 1024 bits. Such keys are insecure and should not be
|
// with a key smaller than 1024 bits. Such keys are insecure and should not be
|
||||||
// used.
|
// used.
|
||||||
//
|
//
|
||||||
// The `rsa1024min=0` GODEBUG setting suppresses this error, but we recommend
|
// The rsa1024min=0 GODEBUG setting suppresses this error, but we recommend
|
||||||
// doing so only in tests, if necessary. Tests can use [testing.T.Setenv] or
|
// doing so only in tests, if necessary. Tests can set this option using
|
||||||
// include `//go:debug rsa1024min=0` in a `_test.go` source file to set it.
|
// [testing.T.Setenv] or by including "//go:debug rsa1024min=0" in a *_test.go
|
||||||
|
// source file.
|
||||||
//
|
//
|
||||||
// Alternatively, see the [GenerateKey (TestKey)] example for a pregenerated
|
// Alternatively, see the [GenerateKey (TestKey)] example for a pregenerated
|
||||||
// test-only 2048-bit key.
|
// test-only 2048-bit key.
|
||||||
//
|
//
|
||||||
// [GenerateKey (TestKey)]: #example-GenerateKey-TestKey
|
// [GenerateKey (TestKey)]: https://pkg.go.dev/crypto/rsa#example-GenerateKey-TestKey
|
||||||
package rsa
|
package rsa
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -226,7 +227,7 @@ type CRTValue struct {
|
||||||
// Validate performs basic sanity checks on the key.
|
// Validate performs basic sanity checks on the key.
|
||||||
// It returns nil if the key is valid, or else an error describing a problem.
|
// It returns nil if the key is valid, or else an error describing a problem.
|
||||||
//
|
//
|
||||||
// It runs faster on valid keys if run after [Precompute].
|
// It runs faster on valid keys if run after [PrivateKey.Precompute].
|
||||||
func (priv *PrivateKey) Validate() error {
|
func (priv *PrivateKey) Validate() error {
|
||||||
// We can operate on keys based on d alone, but it isn't possible to encode
|
// We can operate on keys based on d alone, but it isn't possible to encode
|
||||||
// with [crypto/x509.MarshalPKCS1PrivateKey], which unfortunately doesn't
|
// with [crypto/x509.MarshalPKCS1PrivateKey], which unfortunately doesn't
|
||||||
|
@ -274,7 +275,7 @@ func checkPublicKeySize(k *PublicKey) error {
|
||||||
// returned key does not depend deterministically on the bytes read from rand,
|
// returned key does not depend deterministically on the bytes read from rand,
|
||||||
// and may change between calls and/or between versions.
|
// and may change between calls and/or between versions.
|
||||||
//
|
//
|
||||||
// [Minimum key size]: #hdr-Minimum_key_size
|
// [Minimum key size]: https://pkg.go.dev/crypto/rsa#hdr-Minimum_key_size
|
||||||
func GenerateKey(random io.Reader, bits int) (*PrivateKey, error) {
|
func GenerateKey(random io.Reader, bits int) (*PrivateKey, error) {
|
||||||
if err := checkKeySize(bits); err != nil {
|
if err := checkKeySize(bits); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue