Documentation
¶
Overview ¶
Package pgptest builds OpenPGP fixtures with an independent implementation, for tests in this module.
Internal, and imported only by tests: go-crypto is a reference implementation used to check this one, never a dependency of it. Keeping the fixtures here rather than duplicating them in each package's tests means one definition of "a real message on this curve" — and keeps go-crypto out of every non-test build graph, which depfootprint_test.go asserts.
Index ¶
- func Agree(t *testing.T, sub *openpgp.Subkey, ephemeral []byte, coordinateBytes int) []byte
- func CurveOIDFrom(t *testing.T, raw []byte) []byte
- func EncryptTo(t *testing.T, entity *openpgp.Entity, plaintext []byte) []byte
- func EncryptionSubkey(t *testing.T, entity *openpgp.Entity) *openpgp.Subkey
- func MinInt(a, b int) int
- func NewECDHEntity(t *testing.T, curve packet.Curve) *openpgp.Entity
- func NewFormatBody(t *testing.T, p []byte) []byte
- func OldFormatBody(t *testing.T, p []byte) []byte
- func PacketBody(t *testing.T, p []byte) (tag byte, body []byte)
- func ParsePKESK(t *testing.T, message []byte) (ephemeral, wrapped []byte)
- func RandomBytes(t *testing.T, n int) []byte
- type CurveProfile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Agree ¶
agree performs the ECDH the key service would perform, returning the bare x-coordinate.
func CurveOIDFrom ¶
CurveOIDFrom pulls the curve identifier out of a serialised public-key packet, with its leading length octet, which is the form KDFParams takes.
func NewFormatBody ¶
NewFormatBody reads the RFC 9580 header length encoding.
func OldFormatBody ¶
OldFormatBody reads the legacy CTB length types.
func PacketBody ¶
PacketBody returns a packet's tag and body, handling both the old-format CTB and the new-format header RFC 9580 uses. go-crypto emits new-format headers, so assuming one shape silently misreads the packet.
func ParsePKESK ¶
parsePKESK pulls the ephemeral point and the wrapped key out of the packet by hand: go-crypto keeps both unexported, and reading them independently is what stops this being a comparison of the library with itself. ParsePKESK pulls the ephemeral point and wrapped key out of a message composed elsewhere, so a test has something real to compare against.
Types ¶
type CurveProfile ¶
type CurveProfile struct {
// Name is the curve's OpenPGP name, used as a subtest name.
Name string
// Curve is the identifier go-crypto generates keys for.
Curve packet.Curve
// CoordinateBytes is the curve's coordinate length, which the key
// derivation pads the shared secret to.
CoordinateBytes int
}
CurveProfile pairs a curve with the KDF parameters go-crypto selects for it, so the SHA-384 and SHA-512 arms are exercised against a real implementation rather than against a reconstruction.
func DifferentialCurves ¶
func DifferentialCurves() []CurveProfile