(text []byte)
| 106 | } |
| 107 | |
| 108 | func ParsePublicKey(text []byte) (crypto.PublicKey, error) { |
| 109 | for len(text) > 0 { |
| 110 | var block *pem.Block |
| 111 | block, text = pem.Decode(text) |
| 112 | if block == nil { |
| 113 | return nil, errors.New("signingalgorithm: invalid PEM block in public key.") |
| 114 | } |
| 115 | |
| 116 | pubkey, err := parsePublicKeyBlock(block.Bytes) |
| 117 | if err == nil { |
| 118 | return pubkey, nil |
| 119 | } |
| 120 | } |
| 121 | return nil, errors.New("signingalgorithm: could not find public key.") |
| 122 | } |
| 123 | |
| 124 | // parsePublicKeyBlock parses any allowed type public key. Currently only allows parsing ed25519 type public keys. |
| 125 | func parsePublicKeyBlock(derKey []byte) (crypto.PublicKey, error) { |
no test coverage detected