diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-04-16 17:27:20 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-04-16 17:27:20 -0400 |
| commit | 0d3f55a926e42ffa45febc4cc722f3d7873206e0 (patch) | |
| tree | 01a70ddd2fe4a3de79552aacde411fe3338ae22f /key | |
| parent | 48d43d62e22e02c862b285f8ae5db62256ae5ab6 (diff) | |
| download | hose-0d3f55a926e42ffa45febc4cc722f3d7873206e0.zip | |
call key decoding functions when parsing known_hosts file
Diffstat (limited to 'key')
| -rw-r--r-- | key/box.go | 5 | ||||
| -rw-r--r-- | key/sig.go | 4 |
2 files changed, 7 insertions, 2 deletions
@@ -67,6 +67,11 @@ func (bpk1 BoxPublicKey) Compare(bpk2 BoxPublicKey) int { return bytes.Compare(bpk1[:], bpk2[:]) } +func DecodeBoxPublicKey(buf []byte) (BoxPublicKey, error) { + key, err := decodeBoxKey(buf) + return BoxPublicKey(key), err +} + func decodeBoxKey(buf []byte) ([32]byte, error) { var key [32]byte if hex.DecodedLen(len(buf)) != len(key) { @@ -37,14 +37,14 @@ func LoadSigPublicKey() (SigPublicKey, error) { } // Decode key. - return decodeSigPublicKey(buf) + return DecodeSigPublicKey(buf) } func (spk1 SigPublicKey) Compare(spk2 SigPublicKey) int { return bytes.Compare(spk1[:], spk2[:]) } -func decodeSigPublicKey(buf []byte) (SigPublicKey, error) { +func DecodeSigPublicKey(buf []byte) (SigPublicKey, error) { var key SigPublicKey if hex.DecodedLen(len(buf)) != len(key) { return SigPublicKey{}, fmt.Errorf("malformed signature verification key: expected %d bytes; got %d", |