Skip to content

Commit 426fe5a

Browse files
committed
Add links in doc comments
This will be supported in Go 1.19.
1 parent 18dc7b9 commit 426fe5a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pkcs12.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ func unmarshal(in []byte, out interface{}) error {
138138
//
139139
// Deprecated: ToPEM creates invalid PEM blocks (private keys
140140
// are encoded as raw RSA or EC private keys rather than PKCS#8 despite being
141-
// labeled "PRIVATE KEY"). To decode a PKCS#12 file, use DecodeChain instead,
142-
// and use the encoding/pem package to convert to PEM if necessary.
141+
// labeled "PRIVATE KEY"). To decode a PKCS#12 file, use [DecodeChain] instead,
142+
// and use the [encoding/pem] package to convert to PEM if necessary.
143143
func ToPEM(pfxData []byte, password string) ([]*pem.Block, error) {
144144
encodedPassword, err := bmpStringZeroTerminated(password)
145145
if err != nil {
@@ -248,7 +248,7 @@ func convertAttribute(attribute *pkcs12Attribute) (key, value string, err error)
248248
// Decode extracts a certificate and private key from pfxData, which must be a DER-encoded PKCS#12 file. This function
249249
// assumes that there is only one certificate and only one private key in the
250250
// pfxData. Since PKCS#12 files often contain more than one certificate, you
251-
// probably want to use DecodeChain instead.
251+
// probably want to use [DecodeChain] instead.
252252
func Decode(pfxData []byte, password string) (privateKey interface{}, certificate *x509.Certificate, err error) {
253253
var caCerts []*x509.Certificate
254254
privateKey, certificate, caCerts, err = DecodeChain(pfxData, password)
@@ -445,11 +445,11 @@ func getSafeContents(p12Data, password []byte, expectedItems int) (bags []safeBa
445445
//
446446
// The private key is encrypted with the provided password, but due to the
447447
// weak encryption primitives used by PKCS#12, it is RECOMMENDED that you
448-
// specify a hard-coded password (such as pkcs12.DefaultPassword) and protect
448+
// specify a hard-coded password (such as [DefaultPassword]) and protect
449449
// the resulting pfxData using other means.
450450
//
451451
// The rand argument is used to provide entropy for the encryption, and
452-
// can be set to rand.Reader from the crypto/rand package.
452+
// can be set to [crypto/rand.Reader].
453453
//
454454
// Encode emulates the behavior of OpenSSL's PKCS12_create: it creates two
455455
// SafeContents: one that's encrypted with RC2 and contains the certificates,
@@ -546,11 +546,11 @@ func Encode(rand io.Reader, privateKey interface{}, certificate *x509.Certificat
546546
// allow it to be used as a Java TrustStore in Java 1.8 and newer.
547547
//
548548
// Due to the weak encryption primitives used by PKCS#12, it is RECOMMENDED that
549-
// you specify a hard-coded password (such as pkcs12.DefaultPassword) and protect
549+
// you specify a hard-coded password (such as [DefaultPassword]) and protect
550550
// the resulting pfxData using other means.
551551
//
552552
// The rand argument is used to provide entropy for the encryption, and
553-
// can be set to rand.Reader from the crypto/rand package.
553+
// can be set to [crypto/rand.Reader].
554554
//
555555
// EncodeTrustStore creates a single SafeContents that's encrypted with RC2
556556
// and contains the certificates.
@@ -559,7 +559,7 @@ func Encode(rand io.Reader, privateKey interface{}, certificate *x509.Certificat
559559
// within the resulting pfxData. If certificates share a Subject, then the
560560
// resulting Friendly Names (Aliases) will be identical, which Java may treat as
561561
// the same entry when used as a Java TrustStore, e.g. with `keytool`. To
562-
// customize the Friendly Names, use EncodeTrustStoreEntries.
562+
// customize the Friendly Names, use [EncodeTrustStoreEntries].
563563
func EncodeTrustStore(rand io.Reader, certs []*x509.Certificate, password string) (pfxData []byte, err error) {
564564
var certsWithFriendlyNames []TrustStoreEntry
565565
for _, cert := range certs {
@@ -581,7 +581,7 @@ type TrustStoreEntry struct {
581581
// certificates (entries) to be trusted. The certificates will be marked with a
582582
// special OID that allow it to be used as a Java TrustStore in Java 1.8 and newer.
583583
//
584-
// This is identical to EncodeTrustStore, but also allows for setting specific
584+
// This is identical to [EncodeTrustStore], but also allows for setting specific
585585
// Friendly Names (Aliases) to be used per certificate, by specifying a slice
586586
// of TrustStoreEntry.
587587
//
@@ -590,11 +590,11 @@ type TrustStoreEntry struct {
590590
// may treat as the same entry when used as a Java TrustStore, e.g. with `keytool`.
591591
//
592592
// Due to the weak encryption primitives used by PKCS#12, it is RECOMMENDED that
593-
// you specify a hard-coded password (such as pkcs12.DefaultPassword) and protect
593+
// you specify a hard-coded password (such as [DefaultPassword]) and protect
594594
// the resulting pfxData using other means.
595595
//
596596
// The rand argument is used to provide entropy for the encryption, and
597-
// can be set to rand.Reader from the crypto/rand package.
597+
// can be set to [crypto/rand.Reader].
598598
//
599599
// EncodeTrustStoreEntries creates a single SafeContents that's encrypted
600600
// with RC2 and contains the certificates.

0 commit comments

Comments
 (0)