INNER CODE UNIT · Go
ykAttest
go-piv/piv-go · v2/piv/key.go:630
func ykAttest(tx *scTx, slot Slot) (*x509.Certificate, error) {
cmd := apdu{
instruction: insAttest,
param1: byte(slot.Key),
}
resp, err := tx.Transmit(cmd)
if err != nil {
return nil, fmt.Errorf("command failed: %w", err)
}
if bytes.HasPrefix(resp, []byte{0x70}) {
b, _, err := unmarshalASN1(resp, 0, 0x10) // tag 0x70
if err != nil {
return nil, fmt.Errorf("unmarshaling certificate: %v", err)
}
resp = b
}
cert, err := x509.ParseCertificate(resp)
if err != nil {