title: jcryption 3.0 encryption to java decryption
body: <p>I am trying to use JCrytion 3.0.1 to encrypt data in javascript and then decrypt it on server by java. My question is how I can get the encrypted string to decrypt it in java using Cipher class which requires Byte[] to process.
  <br>
  This is how I generate my key from java <br></p>
  
  <pre><code>final KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
  keyGen.initialize(1024);
  final KeyPair key = keyGen.generateKeyPair();
  </code></pre>
  
  <p><br>
  And then to decrypt data I used<br/></p>
  
  <pre><code>public  String decrypt(byte[] text, PrivateKey key) {
      byte[] dectyptedText = null;
      try {
          final Cipher cipher = Cipher.getInstance("RSA");
          cipher.init(Cipher.DECRYPT_MODE, key);
          dectyptedText = cipher.doFinal(text); // this is where I get error when trying to use getBytes() to convert encrypted string to byte[]
      } catch (Exception ex) {
          ex.printStackTrace();
      }
      return new String(dectyptedText);
  }
  </code></pre>
  
  <p><br>
  This is my javascript on client side<br></p>
  
  <pre><code>var encryptedUser = $.jCryption.encrypt(username, keys);
  var encryptedPassword = $.jCryption.encrypt(password, keys);
              alert("Start Submiting");
              $.ajax({
                  url: "LoginAuthentication",
                  data:{username:encryptedUser, password:encryptedPassword},
                  type:'POST'
              }).done(function(){
                  alert("Successfully Access !!!");
              });
  </code></pre>
  
  <p>I try to use getBytes() but it doesn't work <br>
  It works well with other texts I test. My Only problem is how to convert encrypted string from javascript using JCryption to byte[] to decrypt it in Java.<br>
  Thank You</p>