Documentation
¶
Overview ¶
Package seal keeps the secret values of a job from each reader but its target agents. The controller makes a new random 256-bit key for each job, encrypts each value with it (AES-256-GCM), and seals the job key to the P-256 ECDH key of each target agent. Each algorithm is FIPS 140-3 approved, from the Go standard library.
A job has one ephemeral P-256 key, From, that seals its key to each agent. For an agent with the public key R, the key-encryption key is HKDF-SHA256 of the ECDH secret of From and R, with no salt and the info "osapi-seal-v1" || From || R (each the 65 bytes of its uncompressed point). The sealed key is base64url, with no padding, of the 12-byte nonce, the job key encrypted with AES-256-GCM, and its 16-byte tag; the job ID is the additional data. A sealed value is Prefix, then base64url of the nonce, the value encrypted with the job key, and the tag, with the job ID as the additional data. Thus a value or a key that somebody copies to a different job does not open.
Index ¶
Constants ¶
const Prefix = "sealed:"
Prefix starts each sealed value in the data of a job.
Variables ¶
var ErrNotSealedToAgent = errors.New("the job was not sealed to this agent")
ErrNotSealedToAgent is the error of a job that has sealed values, but no job key for this agent, such as an agent that joined after the controller queued the job.
Functions ¶
Types ¶
type Opener ¶
type Opener struct {
// contains filtered or unexported fields
}
Opener opens the sealed values of one job.
func Open ¶
Open is the Opener of the job jobID: own, the P-256 key of the agent, opens sealedKey, the job key that from sealed to it.
func OpenerFrom ¶
OpenerFrom is the Opener that WithOpener put in ctx, or nil when the job has no sealed value.
type Sealer ¶
type Sealer struct {
// contains filtered or unexported fields
}
Sealer seals the values of one job.
func New ¶
New is a Sealer for the job jobID, with a new random job key, and a new P-256 key that seals the job key to each agent.
func (*Sealer) From ¶
From is the public P-256 key that seals the job key, in pki.EncryptionKeyEncoding. The agent needs it to open the job key.