INNER CODE UNIT · Go

decodeYubikeyRSAPublicKey

go-piv/go-ykpiv · generate.go:62

func decodeYubikeyRSAPublicKey(der []byte) (*rsa.PublicKey, error) {
	byteArray, err := bytearray.DERDecode(der)
	if err != nil {
		return nil, err
	}

	if len(byteArray) != 2 {
		return nil, fmt.Errorf("ykpiv: decodeYubikeyRSAPublicKey: Byte Array isn't length 2")
	}

	n := byteArray[0]
	if n.Tag != 1 {
		return nil, fmt.Errorf("ykpiv: decodeYubikeyRSAPublicKey: I'm confused about n: %x", n.Tag)
	}
	pubN := big.NewInt(0)
	pubN.SetBytes(n.Bytes)

	e := byteArray[1]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…