Class Cipher

java.lang.Object
eirb.pub.app.utils.Cipher

public class Cipher extends Object
  • Constructor Details

    • Cipher

      public Cipher()
  • Method Details

    • encryptAESCBC

      public static byte[] encryptAESCBC(byte[] plain, Key key, InitializationVector iv) throws CipherException
      Encryption with AES CBC
      Parameters:
      plain - byte to encrypt
      key - Key to use for encryption
      iv - Initialization vector to use for CBC
      Returns:
      encrypted bytes
      Throws:
      CipherException - if the encryption process failed
    • decryptAESCBC

      public static byte[] decryptAESCBC(byte[] cipher, Key key, InitializationVector iv) throws CipherException
      Decryption with AES CBC
      Parameters:
      cipher - byte to decrypt
      key - Key to use for decryption
      iv - Initialization vector to use for CBC
      Returns:
      decrypted bytes
      Throws:
      CipherException - if the decryption process failed
    • encryptAESECB

      public static byte[] encryptAESECB(byte[] plain, Key key) throws CipherException
      Encryption with AES ECB
      Parameters:
      plain - byte to encrypt
      key - Key to use for encryption
      Returns:
      encrypted bytes
      Throws:
      CipherException - if the encryption process failed
    • decryptAESECB

      public static byte[] decryptAESECB(byte[] cipher, Key key) throws CipherException
      Decryption with AES ECB
      Parameters:
      cipher - byte to decrypt
      key - Key to use for decryption
      Returns:
      decrypted bytes
      Throws:
      CipherException - if the decryption process failed
    • encryptRSAECB

      public static byte[] encryptRSAECB(byte[] plain, Key key) throws CipherException
      Throws:
      CipherException
    • decryptRSAECB

      public static byte[] decryptRSAECB(byte[] cipher, Key key) throws CipherException
      Throws:
      CipherException