aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/crypto/crypto.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/crypto/crypto.go')
-rw-r--r--libgo/go/crypto/crypto.go26
1 files changed, 23 insertions, 3 deletions
diff --git a/libgo/go/crypto/crypto.go b/libgo/go/crypto/crypto.go
index ce473b5..fe1c069 100644
--- a/libgo/go/crypto/crypto.go
+++ b/libgo/go/crypto/crypto.go
@@ -150,10 +150,30 @@ func RegisterHash(h Hash, f func() hash.Hash) {
}
// PublicKey represents a public key using an unspecified algorithm.
-type PublicKey interface{}
+//
+// 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 any
// PrivateKey represents a private key using an unspecified algorithm.
-type PrivateKey interface{}
+//
+// 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 any
// Signer is an interface for an opaque private key that can be used for
// signing operations. For example, an RSA key kept in a hardware module.
@@ -200,4 +220,4 @@ type Decrypter interface {
Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error)
}
-type DecrypterOpts interface{}
+type DecrypterOpts any