MCPcopy Create free account
hub / github.com/WICG/webpackage / parsePublicKeyBlock

Function parsePublicKeyBlock

go/internal/signingalgorithm/certs.go:125–135  ·  view source on GitHub ↗

parsePublicKeyBlock parses any allowed type public key. Currently only allows parsing ed25519 type public keys.

(derKey []byte)

Source from the content-addressed store, hash-verified

123
124// parsePublicKeyBlock parses any allowed type public key. Currently only allows parsing ed25519 type public keys.
125func parsePublicKeyBlock(derKey []byte) (crypto.PublicKey, error) {
126 if keyInterface, err := x509.ParsePKIXPublicKey(derKey); err == nil {
127 switch typedKey := keyInterface.(type) {
128 case ed25519.PublicKey:
129 return typedKey, nil
130 default:
131 return nil, fmt.Errorf("signingalgorithm: unknown public key type: %T", typedKey)
132 }
133 }
134 return nil, errors.New("signingalgorithm: couldn't parse public key.")
135}

Callers 1

ParsePublicKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected