Skip to content

Commit 303c195

Browse files
author
tomis007
committed
export KeyRSA and KeyEd25519
1 parent 2fae465 commit 303c195

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

v2/piv/key.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,9 +1001,9 @@ func (yk *YubiKey) PrivateKey(slot Slot, public crypto.PublicKey, auth KeyAuth)
10011001
case *ecdsa.PublicKey:
10021002
return &ECDSAPrivateKey{yk, slot, pub, auth, pp}, nil
10031003
case ed25519.PublicKey:
1004-
return &keyEd25519{yk, slot, pub, auth, pp}, nil
1004+
return &KeyEd25519{yk, slot, pub, auth, pp}, nil
10051005
case *rsa.PublicKey:
1006-
return &keyRSA{yk, slot, pub, auth, pp}, nil
1006+
return &KeyRSA{yk, slot, pub, auth, pp}, nil
10071007
case *ecdh.PublicKey:
10081008
if crv := pub.Curve(); crv != ecdh.X25519() {
10091009
return nil, fmt.Errorf("unsupported ecdh curve: %v", crv)
@@ -1283,43 +1283,43 @@ func (k *X25519PrivateKey) ECDH(peer *ecdh.PublicKey) ([]byte, error) {
12831283
})
12841284
}
12851285

1286-
type keyEd25519 struct {
1286+
type KeyEd25519 struct {
12871287
yk *YubiKey
12881288
slot Slot
12891289
pub ed25519.PublicKey
12901290
auth KeyAuth
12911291
pp PINPolicy
12921292
}
12931293

1294-
func (k *keyEd25519) Public() crypto.PublicKey {
1294+
func (k *KeyEd25519) Public() crypto.PublicKey {
12951295
return k.pub
12961296
}
12971297

1298-
func (k *keyEd25519) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) ([]byte, error) {
1298+
func (k *KeyEd25519) Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) ([]byte, error) {
12991299
return k.auth.do(k.yk, k.pp, func(tx *scTx) ([]byte, error) {
13001300
return ykSignEd25519(tx, k.slot, k.pub, message, opts)
13011301
})
13021302
}
13031303

1304-
type keyRSA struct {
1304+
type KeyRSA struct {
13051305
yk *YubiKey
13061306
slot Slot
13071307
pub *rsa.PublicKey
13081308
auth KeyAuth
13091309
pp PINPolicy
13101310
}
13111311

1312-
func (k *keyRSA) Public() crypto.PublicKey {
1312+
func (k *KeyRSA) Public() crypto.PublicKey {
13131313
return k.pub
13141314
}
13151315

1316-
func (k *keyRSA) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) {
1316+
func (k *KeyRSA) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) {
13171317
return k.auth.do(k.yk, k.pp, func(tx *scTx) ([]byte, error) {
13181318
return ykSignRSA(tx, rand, k.slot, k.pub, digest, opts)
13191319
})
13201320
}
13211321

1322-
func (k *keyRSA) Decrypt(rand io.Reader, msg []byte, opts crypto.DecrypterOpts) ([]byte, error) {
1322+
func (k *KeyRSA) Decrypt(rand io.Reader, msg []byte, opts crypto.DecrypterOpts) ([]byte, error) {
13231323
return k.auth.do(k.yk, k.pp, func(tx *scTx) ([]byte, error) {
13241324
return ykDecryptRSA(tx, k.slot, k.pub, msg)
13251325
})

0 commit comments

Comments
 (0)