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

Function parsePrivateKeyBlock

go/internal/signingalgorithm/certs.go:73–84  ·  view source on GitHub ↗
(derKey []byte)

Source from the content-addressed store, hash-verified

71}
72
73func parsePrivateKeyBlock(derKey []byte) (crypto.PrivateKey, error) {
74 // Try each of 2 key formats and take the first one that successfully parses.
75 if key, err := x509.ParseECPrivateKey(derKey); err == nil {
76 return key, nil
77 }
78
79 if keyInterface, err := x509.ParsePKCS8PrivateKey(derKey); err == nil {
80 return typeSupportedPKCS8key(keyInterface)
81 }
82
83 return nil, errors.New("signingalgorithm: couldn't parse private key.")
84}
85
86// parseEncryptedPrivateKeyBlock reads the passphrase to decrypt an encrypted private key from either
87// WEB_BUNDLE_SIGNING_PASSPHRASE environment variable or if not set, it prompts a passphrase from the user.

Callers 1

ParsePrivateKeyFunction · 0.85

Calls 1

typeSupportedPKCS8keyFunction · 0.85

Tested by

no test coverage detected