Module: PQCrypto::Seal::IOAPI
- Defined in:
- lib/pq_crypto/seal/io.rb
Constant Summary collapse
- DEFAULT_CHUNK_SIZE =
1024 * 1024
Class Method Summary collapse
- .add_recipient_file(source, destination, with:, recipient:, current_recipients:, **options) ⇒ Object
- .decrypt_file(source, destination, with:, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, required_padding: nil, **limit_options) ⇒ Object
- .decrypt_frame_io(input, output, with:, **options) ⇒ Object
- .decrypt_io(input, output, with:, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, strict_eof: true, required_padding: nil, **limit_options) ⇒ Object
- .drop_recipient_stanza_file(source, destination, with:, remaining_recipients:, **options) ⇒ Object
- .encrypt_file(source, destination, **options) ⇒ Object
- .encrypt_frame_io(input, output, size:, to:, **options) ⇒ Object
- .encrypt_io(input, output, size:, to:, metadata: "".b, public_metadata: "".b, recipient_capacity: Format::DEFAULT_RECIPIENT_CAPACITY, slot_size: Format::DEFAULT_SLOT_SIZE, padding: :padme, chunk_size: DEFAULT_CHUNK_SIZE, strict_size: true) ⇒ Object
- .inspect_file(source, **limit_options) ⇒ Object
- .rebuild_recipients_file(source, destination, with:, recipients:, chunk_size: DEFAULT_CHUNK_SIZE, **limit_options) ⇒ Object
- .rotate_dek_file(source, destination, with:, recipients:, padding: :preserve, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, **limit_options) ⇒ Object
Class Method Details
.add_recipient_file(source, destination, with:, recipient:, current_recipients:, **options) ⇒ Object
83 84 85 86 87 88 89 90 91 |
# File 'lib/pq_crypto/seal/io.rb', line 83 def add_recipient_file(source, destination, with:, recipient:, current_recipients:, **) rebuild_recipients_file( source, destination, with: with, recipients: Array(current_recipients) + [recipient], ** ) end |
.decrypt_file(source, destination, with:, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, required_padding: nil, **limit_options) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/pq_crypto/seal/io.rb', line 57 def decrypt_file(source, destination, with:, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, required_padding: nil, **) FileOperations.decrypt( source, destination, credentials: with, staging_directory: staging_directory, chunk_size: chunk_size, required_padding: required_padding, limits: ResourceLimits.resolve() ) end |
.decrypt_frame_io(input, output, with:, **options) ⇒ Object
48 49 50 |
# File 'lib/pq_crypto/seal/io.rb', line 48 def decrypt_frame_io(input, output, with:, **) decrypt_io(input, output, with: with, strict_eof: false, **) end |
.decrypt_io(input, output, with:, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, strict_eof: true, required_padding: nil, **limit_options) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pq_crypto/seal/io.rb', line 29 def decrypt_io(input, output, with:, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, strict_eof: true, required_padding: nil, **) StreamingDecryptor.new( input, output, credentials: with, staging_directory: staging_directory, chunk_size: chunk_size, strict_eof: strict_eof, required_padding: required_padding, limits: ResourceLimits.resolve() ).call end |
.drop_recipient_stanza_file(source, destination, with:, remaining_recipients:, **options) ⇒ Object
93 94 95 |
# File 'lib/pq_crypto/seal/io.rb', line 93 def drop_recipient_stanza_file(source, destination, with:, remaining_recipients:, **) rebuild_recipients_file(source, destination, with: with, recipients: remaining_recipients, **) end |
.encrypt_file(source, destination, **options) ⇒ Object
52 53 54 55 |
# File 'lib/pq_crypto/seal/io.rb', line 52 def encrypt_file(source, destination, **) = () FileOperations.encrypt(source, destination, **) end |
.encrypt_frame_io(input, output, size:, to:, **options) ⇒ Object
44 45 46 |
# File 'lib/pq_crypto/seal/io.rb', line 44 def encrypt_frame_io(input, output, size:, to:, **) encrypt_io(input, output, size: size, to: to, strict_size: false, **) end |
.encrypt_io(input, output, size:, to:, metadata: "".b, public_metadata: "".b, recipient_capacity: Format::DEFAULT_RECIPIENT_CAPACITY, slot_size: Format::DEFAULT_SLOT_SIZE, padding: :padme, chunk_size: DEFAULT_CHUNK_SIZE, strict_size: true) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pq_crypto/seal/io.rb', line 10 def encrypt_io(input, output, size:, to:, metadata: "".b, public_metadata: "".b, recipient_capacity: Format::DEFAULT_RECIPIENT_CAPACITY, slot_size: Format::DEFAULT_SLOT_SIZE, padding: :padme, chunk_size: DEFAULT_CHUNK_SIZE, strict_size: true) StreamingEncryptor.new( input, output, size: size, to: to, metadata: , public_metadata: , recipient_capacity: recipient_capacity, slot_size: slot_size, padding: padding, chunk_size: chunk_size, strict_size: strict_size ).call end |
.inspect_file(source, **limit_options) ⇒ Object
112 113 114 |
# File 'lib/pq_crypto/seal/io.rb', line 112 def inspect_file(source, **) FileOperations.inspect(source, limits: ResourceLimits.resolve()) end |
.rebuild_recipients_file(source, destination, with:, recipients:, chunk_size: DEFAULT_CHUNK_SIZE, **limit_options) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/pq_crypto/seal/io.rb', line 71 def rebuild_recipients_file(source, destination, with:, recipients:, chunk_size: DEFAULT_CHUNK_SIZE, **) FileRecipientRebuilder.new( source, destination, credentials: with, recipients: recipients, chunk_size: chunk_size, limits: ResourceLimits.resolve() ).call end |
.rotate_dek_file(source, destination, with:, recipients:, padding: :preserve, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, **limit_options) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/pq_crypto/seal/io.rb', line 97 def rotate_dek_file(source, destination, with:, recipients:, padding: :preserve, staging_directory: nil, chunk_size: DEFAULT_CHUNK_SIZE, **) FileDekRotator.new( source, destination, credentials: with, recipients: recipients, padding: padding, staging_directory: staging_directory, chunk_size: chunk_size, limits: ResourceLimits.resolve() ).call end |