Class: Karafka::Pro::Encryption::Cipher
- Inherits:
 - 
      Object
      
        
- Object
 - Karafka::Pro::Encryption::Cipher
 
 
- Defined in:
 - lib/karafka/pro/encryption/cipher.rb
 
Overview
Cipher for encrypting and decrypting data
Instance Method Summary collapse
- 
  
    
      #decrypt(version, content)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
Decrypts provided content using ‘version` key.
 - 
  
    
      #encrypt(content)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    
Encrypts given string content with the public key.
 - 
  
    
      #initialize  ⇒ Cipher 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Cipher.
 
Constructor Details
#initialize ⇒ Cipher
Returns a new instance of Cipher.
      23 24 25  | 
    
      # File 'lib/karafka/pro/encryption/cipher.rb', line 23 def initialize @private_pems = {} end  | 
  
Instance Method Details
#decrypt(version, content) ⇒ String
Decrypts provided content using ‘version` key
      38 39 40  | 
    
      # File 'lib/karafka/pro/encryption/cipher.rb', line 38 def decrypt(version, content) private_pem(version).private_decrypt(content) end  | 
  
#encrypt(content) ⇒ String
Encrypts given string content with the public key
      30 31 32  | 
    
      # File 'lib/karafka/pro/encryption/cipher.rb', line 30 def encrypt(content) public_pem.public_encrypt(content) end  |