Class UnbreakableEncryption

java.lang.Object
org.example.chapter1_small_problems.UnbreakableEncryption

public class UnbreakableEncryption extends Object
Unbreakable encryption with one-time cipher.
  • Constructor Details

    • UnbreakableEncryption

      public UnbreakableEncryption()
  • Method Details

    • encrypt

      public static KeyPair encrypt(String original)
      String encryption to KeyPair.
      Parameters:
      original - string to be encrypted
      Returns:
      key pair with dummy and encrypted keys
    • decrypt

      public static String decrypt(KeyPair keyPair)
      Decryption KeyPair to original string.
      Parameters:
      keyPair - key pair with dummy and encrypted keys
      Returns:
      string decrypted from key pair
    • encryptImage

      public static KeyPairImages encryptImage(String original) throws IOException
      Image encryption to KeyPairImage.
      Parameters:
      original - path to the image
      Returns:
      key pair with BufferedImage and dummy key
      Throws:
      IOException - if file from 'path' doesn't exist
    • decryptImage

      public static void decryptImage(KeyPairImages keyPair, String path) throws IOException
      Decryption KeyPairImage to original image.
      Parameters:
      keyPair - key pair with dummy and encrypted keys
      path - path to the image
      Throws:
      IOException