INNER CODE UNIT · Go
decodePrivateKey
minio/kes · cmd/kes/main.go:250
func decodePrivateKey(pemBlock []byte) (*pem.Block, error) {
ErrNoPrivateKey := errors.New("no PEM-encoded private key found")
for len(pemBlock) > 0 {
next, rest := pem.Decode(pemBlock)
if next == nil {
return nil, ErrNoPrivateKey
}
if next.Type == "PRIVATE KEY" || strings.HasSuffix(next.Type, " PRIVATE KEY") {
return next, nil
}
pemBlock = rest
}
return nil, ErrNoPrivateKey
}