Documentation
¶
Overview ¶
Package devicekey reads the key pair a device enrols with: the agent's SSH host key, whose public half the device record stores as PEM. A device proves it holds the private half by signing a server challenge with Sign, which the server checks with Verify.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidPublicKey = errors.New("invalid device public key")
ErrInvalidPublicKey is returned when a device's stored key is not a PEM public key.
var ErrInvalidSignature = errors.New("invalid device key signature")
ErrInvalidSignature is returned when a signature does not prove possession of a device key.
Functions ¶
func ParsePublicKey ¶
ParsePublicKey reads a device public key stored as PEM: an "RSA PUBLIC KEY" block as PKCS#1, which is what the agent sends, and any other block as PKIX. It returns ErrInvalidPublicKey when there is no PEM block, the block does not parse that way, or the key is of a type x/crypto/ssh cannot represent.
func Sign ¶
Sign signs statement with key, which must be the private half of statement's public key, the device's enrolled key; Sign does not check that, and Verify refuses what a mismatched key signs. It returns the signature in the form Verify reads, or the error x/crypto/ssh returns for a key type it cannot sign with or a signature that fails.