From 303c1952cfac96f72e2bc510a1aa21bab9c0f4eb Mon Sep 17 00:00:00 2001 From: tomis007 Date: Sun, 22 Dec 2024 19:01:28 -0500 Subject: [PATCH] export KeyRSA and KeyEd25519 --- v2/piv/key.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/v2/piv/key.go b/v2/piv/key.go index 177d6ae..d15ffc5 100644 --- a/v2/piv/key.go +++ b/v2/piv/key.go @@ -1001,9 +1001,9 @@ func (yk *YubiKey) PrivateKey(slot Slot, public crypto.PublicKey, auth KeyAuth) case *ecdsa.PublicKey: return &ECDSAPrivateKey{yk, slot, pub, auth, pp}, nil case ed25519.PublicKey: - return &keyEd25519{yk, slot, pub, auth, pp}, nil + return &KeyEd25519{yk, slot, pub, auth, pp}, nil case *rsa.PublicKey: - return &keyRSA{yk, slot, pub, auth, pp}, nil + return &KeyRSA{yk, slot, pub, auth, pp}, nil case *ecdh.PublicKey: if crv := pub.Curve(); crv != ecdh.X25519() { return nil, fmt.Errorf("unsupported ecdh curve: %v", crv) @@ -1283,7 +1283,7 @@ func (k *X25519PrivateKey) ECDH(peer *ecdh.PublicKey) ([]byte, error) { }) } -type keyEd25519 struct { +type KeyEd25519 struct { yk *YubiKey slot Slot pub ed25519.PublicKey @@ -1291,17 +1291,17 @@ type keyEd25519 struct { pp PINPolicy } -func (k *keyEd25519) Public() crypto.PublicKey { +func (k *KeyEd25519) Public() crypto.PublicKey { return k.pub } -func (k *keyEd25519) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) ([]byte, error) { +func (k *KeyEd25519) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) ([]byte, error) { return k.auth.do(k.yk, k.pp, func(tx *scTx) ([]byte, error) { return ykSignEd25519(tx, k.slot, k.pub, message, opts) }) } -type keyRSA struct { +type KeyRSA struct { yk *YubiKey slot Slot pub *rsa.PublicKey @@ -1309,17 +1309,17 @@ type keyRSA struct { pp PINPolicy } -func (k *keyRSA) Public() crypto.PublicKey { +func (k *KeyRSA) Public() crypto.PublicKey { return k.pub } -func (k *keyRSA) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) { +func (k *KeyRSA) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) { return k.auth.do(k.yk, k.pp, func(tx *scTx) ([]byte, error) { return ykSignRSA(tx, rand, k.slot, k.pub, digest, opts) }) } -func (k *keyRSA) Decrypt(rand io.Reader, msg []byte, opts crypto.DecrypterOpts) ([]byte, error) { +func (k *KeyRSA) Decrypt(rand io.Reader, msg []byte, opts crypto.DecrypterOpts) ([]byte, error) { return k.auth.do(k.yk, k.pp, func(tx *scTx) ([]byte, error) { return ykDecryptRSA(tx, k.slot, k.pub, msg) })