Decrypting Value From A Key

Aug 30, 2014

I got a the key: "HK8N99LQ"

and the Value:

"THBiUURtaHdCSDlFRWYva1VSRm5QUCtWN2NnditldVE2RnhEa zdLNHlwZEZZQnlxU0xDQ3Zlc1ZrV1RNNHgyamcyNXgvUFUxQk1 UQVpPLzJTVDZnR3ZIUTZLbjRoemo4aU9ORVdKZ21kdktjOEZqZ UM0bkwvd29hbWM3bXQ2cXcvbjZRaUdtZDU5ZWtUSlFMZm1DUHZ aL284OGdqd1JJTGNvQzczb1dISTNScFhSc3VDemRRVTM2bmNic lM4b2FuTWM5RUE2UnUvL1RoT0tSOGFScDltSHZaY2R2MHNQS2x COGZOOUkzazcvVmtCZ2FpTnNwZ3p4aGVBWkJtUWJzN1M2YnAyM DJvMXFUMHdCYk9MUG5vNUNOaEtrVTZCZ2RJWTh3dzNqMDR6VVk vMTNNUW0reGtrUT090"

from [URL] ....

to decrypt the code in c# the website provide this code:

public static string Decrypt(string app_token, string signed_request) {
byte[] keyArray;
//get the byte code of the string
  byte[] toEncryptArray = Convert.FromBase64String(signed_request);
  // app token
string key = app_token;
 
[Code] .....

But how I decrypt it in Java, I tried to use that code but I got error message:

public String Decrypt(String signed_request) {
String decryptedString = null;
try {
// Generate the secret key specs.
byte[] key = "HK8N99LQ".getBytes();

[Code] ....

Error Message:
Input length must be multiple of 16 when decrypting with padded cipher.

View Replies


ADVERTISEMENT

Decrypting A File With Array

May 17, 2015

My assignment is to encrypt and then decrypt a file in Java. I used an array to add 100 to each character per the assignment but I need figuring out a way to subtract the 100 from each character so the file is decrypted again. I tried to create another array to decrement the 100 from each character but cant seem to figure it out/get it working. Here is my assignment and my code so far:

"Although there are complex encryption techniques, you should come up with a simple one of your own. For example, you can read the first file one character at a time, and add 100 to the character code of each character before it is written to the second file.

Then write a program to decrypt the second file. The program should read the content of the second file, restore the data to its original state, and write to a third file."

import java.io.*;
public class FileEncryption {
public static void main(String [] args)
throws IOException {
int[] encrypt = { 100 };

[Code] ....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved