aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo@golang.org>2021-09-29 13:09:34 +0200
committerFilippo Valsorda <filippo@golang.org>2021-09-30 15:20:44 +0000
commit7162c4c7caf72a3f29d3ceee48ff352dab659472 (patch)
treec521606a9bcbac687d0f90fa7d8d604b7e36f3c1 /src
parent6b0026ae31720a01f846335d05e42e67e3a2a7cc (diff)
downloadgo-7162c4c7caf72a3f29d3ceee48ff352dab659472.tar.xz
crypto: document the extended key interfaces
Change-Id: Iaff3f77b0a168e8bde981c791035a6451b3a49ac Reviewed-on: https://go-review.googlesource.com/c/go/+/353049 Trust: Filippo Valsorda <filippo@golang.org> Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/crypto/crypto.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/crypto/crypto.go b/src/crypto/crypto.go
index ce473b5afe..cb87972afc 100644
--- a/src/crypto/crypto.go
+++ b/src/crypto/crypto.go
@@ -150,9 +150,29 @@ func RegisterHash(h Hash, f func() hash.Hash) {
}
// PublicKey represents a public key using an unspecified algorithm.
+//
+// Although this type is an empty interface for backwards compatibility reasons,
+// all public key types in the standard library implement the following interface
+//
+// interface{
+// Equal(x crypto.PublicKey) bool
+// }
+//
+// which can be used for increased type safety within applications.
type PublicKey interface{}
// PrivateKey represents a private key using an unspecified algorithm.
+//
+// Although this type is an empty interface for backwards compatibility reasons,
+// all private key types in the standard library implement the following interface
+//
+// interface{
+// Public() crypto.PublicKey
+// Equal(x crypto.PrivateKey) bool
+// }
+//
+// as well as purpose-specific interfaces such as Signer and Decrypter, which
+// can be used for increased type safety within applications.
type PrivateKey interface{}
// Signer is an interface for an opaque private key that can be used for