Class: SshTresor::Slot

Inherits:
Struct
  • Object
show all
Defined in:
lib/ssh_tresor/format.rb

Overview

One key-wrapping slot in a SSHTRESR blob.

A slot stores public metadata plus an encrypted copy of the data master key. The slot key is not stored; it is re-derived from an SSH-agent signature over the stored challenge.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#challengeString

random challenge signed by the SSH agent.

Returns:

  • (String)

    the current value of challenge



19
20
21
# File 'lib/ssh_tresor/format.rb', line 19

def challenge
  @challenge
end

#encrypted_keyString

AES-GCM ciphertext and tag for the master key.

Returns:

  • (String)

    the current value of encrypted_key



19
20
21
# File 'lib/ssh_tresor/format.rb', line 19

def encrypted_key
  @encrypted_key
end

#fingerprintString

raw 32-byte SHA-256 public-key fingerprint.

Returns:

  • (String)

    the current value of fingerprint



19
20
21
# File 'lib/ssh_tresor/format.rb', line 19

def fingerprint
  @fingerprint
end

#nonceString

AES-GCM nonce for the encrypted master key.

Returns:

  • (String)

    the current value of nonce



19
20
21
# File 'lib/ssh_tresor/format.rb', line 19

def nonce
  @nonce
end

Instance Method Details

#to_bytesString

Serializes the fixed-width slot fields.

Returns:

  • (String)

    binary slot data.



23
24
25
# File 'lib/ssh_tresor/format.rb', line 23

def to_bytes
  fingerprint + challenge + nonce + encrypted_key
end