Skip to content

Commit

Permalink
wgcfg: improve SymmetricKey docs
Browse files Browse the repository at this point in the history
Signed-off-by: David Crawshaw <[email protected]>
  • Loading branch information
crawshaw committed Mar 31, 2020
1 parent 024d6ea commit d127a16
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions wgcfg/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ func ParseSymmetricHexKey(s string) (SymmetricKey, error) {
return key, nil
}

// SymmetricKey is a chacha20poly1305 key.
// It is used by WireGuard to represent pre-shared symmetric keys.
// SymmetricKey is a 32-byte value used as a pre-shared key.
type SymmetricKey [chacha20poly1305.KeySize]byte

This comment has been minimized.

Copy link
@zx2c4

zx2c4 Apr 2, 2020

Member

chacha20poly1305.KeySize is still the wrong constant to be using here. The right constant is just "32", as it's specified in section 9 of the noise spec: http://noiseprotocol.org/noise.html#pre-shared-symmetric-keys

This comment has been minimized.

Copy link
@zx2c4

zx2c4 Apr 2, 2020

Member

The proper type name here would be "PresharedKey" rather than "SymmetricKey", since the latter is generally thought of as the chapoly key used on the transport layer.


func (k SymmetricKey) Base64() string { return base64.StdEncoding.EncodeToString(k[:]) }
Expand Down

0 comments on commit d127a16

Please sign in to comment.