Class: PQCrypto::Seal::RecipientRebuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/pq_crypto/seal/core.rb

Instance Method Summary collapse

Constructor Details

#initialize(envelope, credentials:, recipients:, limits:) ⇒ RecipientRebuilder

Returns a new instance of RecipientRebuilder.



90
91
92
93
94
# File 'lib/pq_crypto/seal/core.rb', line 90

def initialize(envelope, credentials:, recipients:, limits:)
  @envelope = Envelope.parse(envelope, limits: limits)
  @credentials = credentials
  @recipients = KeyMaterial.public_keys(recipients)
end

Instance Method Details

#callObject



96
97
98
99
100
101
102
103
# File 'lib/pq_crypto/seal/core.rb', line 96

def call
  Format.validate_capacity!(@envelope.header.recipient_capacity, @recipients.length)
  dek = @envelope.unwrap_dek(@credentials)
  @envelope.verify_payload!(dek)
  @envelope.replace_section(build_section(dek))
ensure
  Secrets.wipe!(dek)
end