Module: Ronin::Support::Crypto::Mixin
- Included in:
- Mixin
- Defined in:
- lib/ronin/support/crypto/mixin.rb
Overview
Provides helper methods for cryptographic functions.
Instance Method Summary collapse
-
#crypto_aes128_cipher(**kwargs) ⇒ Cipher::AES
(also: #aes128_cipher)
Creates a new AES-128 cipher.
-
#crypto_aes128_decrypt(data, **kwargs) ⇒ String
(also: #aes128_decrypt)
Decrypts data using AES-128.
-
#crypto_aes128_encrypt(data, **kwargs) ⇒ String
(also: #aes128_encrypt)
Encrypts data using AES-128.
-
#crypto_aes256_cipher(**kwargs) ⇒ Cipher::AES
(also: #aes256_cipher)
Creates a new AES-256 cipher.
-
#crypto_aes256_decrypt(data, **kwargs) ⇒ String
(also: #aes256_decrypt)
Decrypts data using AES-256.
-
#crypto_aes256_encrypt(data, **kwargs) ⇒ String
(also: #aes256_encrypt)
Encrypts data using AES-256.
-
#crypto_aes_cipher(**kwargs) ⇒ Cipher::AES
(also: #aes_cipher)
Creates a new AES cipher.
-
#crypto_aes_decrypt(data, **kwargs) ⇒ String
(also: #aes_decrypt)
Decrypts data using AES.
-
#crypto_aes_encrypt(data, **kwargs) ⇒ String
(also: #aes_encrypt)
Encrypts data using AES.
-
#crypto_cipher(name, **kwargs) ⇒ OpenSSL::Cipher
(also: #cipher)
Creates a cipher.
-
#crypto_decrypt(data, cipher:, **kwargs) ⇒ String
(also: #decrypt)
Decrypts data using the cipher.
-
#crypto_digest(name) ⇒ OpenSSL::Digest
(also: #digest)
Looks up a digest.
-
#crypto_encrypt(data, cipher:, **kwargs) ⇒ String
(also: #encrypt)
Encrypts data using the cipher.
-
#crypto_hmac(data = nil, key:, digest: :sha1) ⇒ String
(also: #hmac)
Creates a new HMAC.
-
#crypto_rsa_decrypt(data, **kwargs) ⇒ String
(also: #rsa_decrypt)
Decrypts the given data using the given RSA key.
-
#crypto_rsa_encrypt(data, **kwargs) ⇒ String
(also: #rsa_encrypt)
Encrypts the given data using the given RSA key.
Instance Method Details
#crypto_aes128_cipher(**kwargs) ⇒ Cipher::AES Also known as: aes128_cipher
Creates a new AES-128 cipher.
341 342 343 |
# File 'lib/ronin/support/crypto/mixin.rb', line 341 def crypto_aes128_cipher(**kwargs) Crypto.aes128_cipher(**kwargs) end |
#crypto_aes128_decrypt(data, **kwargs) ⇒ String Also known as: aes128_decrypt
Decrypts data using AES-128.
423 424 425 |
# File 'lib/ronin/support/crypto/mixin.rb', line 423 def crypto_aes128_decrypt(data,**kwargs) Crypto.aes128_decrypt(data,**kwargs) end |
#crypto_aes128_encrypt(data, **kwargs) ⇒ String Also known as: aes128_encrypt
Encrypts data using AES-128.
382 383 384 |
# File 'lib/ronin/support/crypto/mixin.rb', line 382 def crypto_aes128_encrypt(data,**kwargs) Crypto.aes128_encrypt(data,**kwargs) end |
#crypto_aes256_cipher(**kwargs) ⇒ Cipher::AES Also known as: aes256_cipher
Creates a new AES-256 cipher.
462 463 464 |
# File 'lib/ronin/support/crypto/mixin.rb', line 462 def crypto_aes256_cipher(**kwargs) Crypto.aes256_cipher(**kwargs) end |
#crypto_aes256_decrypt(data, **kwargs) ⇒ String Also known as: aes256_decrypt
Decrypts data using AES-256.
544 545 546 |
# File 'lib/ronin/support/crypto/mixin.rb', line 544 def crypto_aes256_decrypt(data,**kwargs) Crypto.aes256_decrypt(data,**kwargs) end |
#crypto_aes256_encrypt(data, **kwargs) ⇒ String Also known as: aes256_encrypt
Encrypts data using AES-256.
503 504 505 |
# File 'lib/ronin/support/crypto/mixin.rb', line 503 def crypto_aes256_encrypt(data,**kwargs) Crypto.aes256_encrypt(data,**kwargs) end |
#crypto_aes_cipher(**kwargs) ⇒ Cipher::AES Also known as: aes_cipher
Creates a new AES cipher.
214 215 216 |
# File 'lib/ronin/support/crypto/mixin.rb', line 214 def crypto_aes_cipher(**kwargs) Crypto.aes_cipher(**kwargs) end |
#crypto_aes_decrypt(data, **kwargs) ⇒ String Also known as: aes_decrypt
Decrypts data using AES.
302 303 304 |
# File 'lib/ronin/support/crypto/mixin.rb', line 302 def crypto_aes_decrypt(data,**kwargs) Crypto.aes_decrypt(data,**kwargs) end |
#crypto_aes_encrypt(data, **kwargs) ⇒ String Also known as: aes_encrypt
Encrypts data using AES.
258 259 260 |
# File 'lib/ronin/support/crypto/mixin.rb', line 258 def crypto_aes_encrypt(data,**kwargs) Crypto.aes_encrypt(data,**kwargs) end |
#crypto_cipher(name, **kwargs) ⇒ OpenSSL::Cipher Also known as: cipher
Creates a cipher.
120 121 122 |
# File 'lib/ronin/support/crypto/mixin.rb', line 120 def crypto_cipher(name,**kwargs) Crypto.cipher(name,**kwargs) end |
#crypto_decrypt(data, cipher:, **kwargs) ⇒ String Also known as: decrypt
Decrypts data using the cipher.
172 173 174 |
# File 'lib/ronin/support/crypto/mixin.rb', line 172 def crypto_decrypt(data, cipher: ,**kwargs) Crypto.decrypt(data, cipher: cipher, **kwargs) end |
#crypto_digest(name) ⇒ OpenSSL::Digest Also known as: digest
Looks up a digest.
47 48 49 |
# File 'lib/ronin/support/crypto/mixin.rb', line 47 def crypto_digest(name) Crypto.digest(name) end |
#crypto_encrypt(data, cipher:, **kwargs) ⇒ String Also known as: encrypt
Encrypts data using the cipher.
146 147 148 |
# File 'lib/ronin/support/crypto/mixin.rb', line 146 def crypto_encrypt(data, cipher: ,**kwargs) Crypto.encrypt(data, cipher: cipher, **kwargs) end |
#crypto_hmac(data = nil, key:, digest: :sha1) ⇒ String Also known as: hmac
Creates a new HMAC.
75 76 77 |
# File 'lib/ronin/support/crypto/mixin.rb', line 75 def crypto_hmac(data=nil, key: , digest: :sha1) Crypto.hmac(data, key: key, digest: digest) end |
#crypto_rsa_decrypt(data, **kwargs) ⇒ String Also known as: rsa_decrypt
Decrypts the given data using the given RSA key.
Optional padding mode. nil
and false
will disable padding.
612 613 614 |
# File 'lib/ronin/support/crypto/mixin.rb', line 612 def crypto_rsa_decrypt(data,**kwargs) Crypto.rsa_decrypt(data,**kwargs) end |
#crypto_rsa_encrypt(data, **kwargs) ⇒ String Also known as: rsa_encrypt
Encrypts the given data using the given RSA key.
Optional padding mode. nil
and false
will disable padding.
578 579 580 |
# File 'lib/ronin/support/crypto/mixin.rb', line 578 def crypto_rsa_encrypt(data,**kwargs) Crypto.rsa_encrypt(data,**kwargs) end |