Skip to content

Commit 2304fec

Browse files
committed
add method to read user pub key from bytes
1 parent 7728bd3 commit 2304fec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cert.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ func (ca *ClientCertAuth) ReadFile(filepath string) error {
2525
return nil
2626
}
2727

28+
func (ca *ClientCertAuth) ReadBytes(pub []byte) error {
29+
hc, _, _, _, err := ParseAuthorizedKey(pub)
30+
if err != nil {
31+
return err
32+
}
33+
ca.UserCaKeyPub = hc
34+
return nil
35+
}
36+
2837
func (ca *ClientCertAuth) CheckClientCert(ctx Context, key PublicKey) bool {
2938
validCert, ok := key.(*gossh.Certificate)
3039
if !ok {

0 commit comments

Comments
 (0)