Module: CcipherFactory::SymKeyCipher::SymKeyAttEncrypt
- Includes:
- Common, Compression::CompressionHelper
- Defined in:
- lib/ccipher_factory/symkey_cipher/symkey_att_encrypt.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#mode ⇒ Object
Returns the value of attribute mode.
Instance Method Summary collapse
- #att_encrypt_final ⇒ Object
- #att_encrypt_init(*args, &block) ⇒ Object
- #att_encrypt_update(val) ⇒ Object
- #method_missing(mtd, *args, &block) ⇒ Object
Methods included from Compression::CompressionHelper
#compress_data_if_active, #compression_off, #compression_on, #compressor, #decompress_data_if_active, #decompressor, #decompressor_from_encoded, #encode_null_compressor, #is_compression_on?, #logger
Methods included from Common
#attach_mode, #cleanup_intOutputBuf, #cleanup_intOutputFile, #detach_mode, #disposeOutput, #intOutputBuf, #intOutputFile, #is_attach_mode?, #is_output_given?, #output, #output_obj, #sanitize_symbol, #write_to_output
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mtd, *args, &block) ⇒ Object
57 58 59 60 61 |
# File 'lib/ccipher_factory/symkey_cipher/symkey_att_encrypt.rb', line 57 def method_missing(mtd, *args, &block) if not_empty?(@enc) @enc.send(mtd, *args, &block) end end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
13 14 15 |
# File 'lib/ccipher_factory/symkey_cipher/symkey_att_encrypt.rb', line 13 def key @key end |
#mode ⇒ Object
Returns the value of attribute mode.
13 14 15 |
# File 'lib/ccipher_factory/symkey_cipher/symkey_att_encrypt.rb', line 13 def mode @mode end |
Instance Method Details
#att_encrypt_final ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ccipher_factory/symkey_cipher/symkey_att_encrypt.rb', line 41 def att_encrypt_final = @enc.encrypt_final write_to_output() intOutputFile.rewind while not intOutputFile.eof? write_to_output(intOutputFile.read) end intOutputFile.close! nil end |
#att_encrypt_init(*args, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ccipher_factory/symkey_cipher/symkey_att_encrypt.rb', line 14 def att_encrypt_init(*args, &block) raise SymKeyCipherError, "Cipher requires output to be set" if not is_output_given? @enc = SymKeyCipher.encryptor @enc.compression_on if is_compression_on? @enc.output(intOutputFile) @enc.key = @key @enc.mode = @mode if not_empty?(@mode) @enc.encrypt_init(*args) if block instance_eval(&block) att_encrypt_final else self end end |
#att_encrypt_update(val) ⇒ Object
35 36 37 38 39 |
# File 'lib/ccipher_factory/symkey_cipher/symkey_att_encrypt.rb', line 35 def att_encrypt_update(val) raise SymKeyCipherError, "Please call att_encrypt_init() before calling update()" if @enc.nil? @enc.encrypt_update(val) end |