Package com.drighetto.essai.bouncycastle.cipher

Examples of com.drighetto.essai.bouncycastle.cipher.AsymmetricKeyLongTextCipher


    System.out.println("---[Bouncy Castle Sample]---");
    try {
      /* Cipher Sample */
      System.out.println("[Cipher Sample]");
      AsymmetricKeyLongTextCipher asymmetricKeyCipher = new AsymmetricKeyLongTextCipher();
      String longText = RandomStringUtils.randomAlphanumeric(5000);
      System.out.println("**Sample 1 : Encryption**");
      System.out.println("Key size         : [" + asymmetricKeyCipher.getKeySize() + "]");
      System.out.println("Original message : [" + longText + "]");
      System.out.println("Size             : [" + longText.length() + "]");
      byte[] tempEncrypt = asymmetricKeyCipher.encrypt(longText.getBytes());
      System.out.println("**Sample 2 : Decryption**");
      byte[] tempDecrypt = asymmetricKeyCipher.decrypt(tempEncrypt);
      String tmpStr = new String(tempDecrypt);
      System.out.println("message          : [" + tmpStr + "]");
      System.out.println("Size             : [" + tmpStr.length() + "]");
      if (longText.equals(tmpStr)) {
        System.out.println("OK - Message is equal before and after encryption/decryption !");
View Full Code Here

TOP

Related Classes of com.drighetto.essai.bouncycastle.cipher.AsymmetricKeyLongTextCipher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.