UnmarshalBinary does the deserialization.
(keyBytes []byte)
| 69 | |
| 70 | // UnmarshalBinary does the deserialization. |
| 71 | func (k *PublicKey) UnmarshalBinary(keyBytes []byte) (err error) { |
| 72 | pubKeyI, ok := parsedPublicKeyCache.Load(string(keyBytes)) |
| 73 | if ok { |
| 74 | *k = *pubKeyI.(*PublicKey) |
| 75 | } else { |
| 76 | pubNew, err := ParsePubKey(keyBytes) |
| 77 | if err == nil { |
| 78 | *k = *pubNew |
| 79 | parsedPublicKeyCache.Store(string(keyBytes), pubNew) |
| 80 | } |
| 81 | } |
| 82 | return |
| 83 | } |
| 84 | |
| 85 | // MarshalYAML implements the yaml.Marshaler interface. |
| 86 | func (k PublicKey) MarshalYAML() (interface{}, error) { |