aes

AES encrypt with openssl command line tool, and decrypt in Java

南笙酒味 提交于 2019-12-18 11:12:00
问题 I have a bash script that uses the openssl tool to encrypt. #!/bin/bash key128="1234567890123456" iv="1234567890123456" openssl enc -aes-128-cbc -in test -out test.enc -K $key128 -iv $iv And Java code that tries to decrypt the file produced by the script. public class crypto { public static void main( String[] args ) { try { File f = new File("test.enc"); Cipher c; Key k; String secretString = "01020304050607080900010203040506"; String ivString = "01020304050607080900010203040506"; byte[]

Encryption of Strings works, encryption of byte[] array type does not work

橙三吉。 提交于 2019-12-18 10:58:27
问题 I am using the following LINK for encryption and tried it with Strings and it worked. However, since I am dealing with images, I needed the encryption/decryption process to happen with byte arrays. So I modified the code in that link to the following: public class AESencrp { private static final String ALGO = "AES"; private static final byte[] keyValue = new byte[] { 'T', 'h', 'e', 'B', 'e', 's', 't', 'S', 'e', 'c', 'r','e', 't', 'K', 'e', 'y' }; public static byte[] encrypt(byte[] Data)

Decode a Base64 String using CryptoJS

爱⌒轻易说出口 提交于 2019-12-18 10:56:55
问题 I am trying to create a simple webpage with the goal to send and encrypted message to the server (which will create a file with that content), then a link is created and the user who receive the link provided will be able to see the encrypted value (since it provides the name of the file and the key). The message is encrypted using CryptoJS AES, and the result is Base64 encoded to be decoded after that, only the Base64 of the encrypted message and the encrypted message is sent to the server

AES 128 encryption in Java Decryption in PHP

半城伤御伤魂 提交于 2019-12-18 10:44:29
问题 I have been trying to decrypt a string using AES-128 CBC which was originally crypted using JAVA AES encryption. In java PKCS7 padding is used. And I have tried to encrypt and decrypt using similar PHP code. But I am getting different result. My Java code import java.security.MessageDigest; import java.security.spec.AlgorithmParameterSpec; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import android.util.Base64; /** * @author

Android 4.2 broke my AES encrypt/decrypt code

给你一囗甜甜゛ 提交于 2019-12-18 10:33:24
问题 It's my first time asking for help in here, my department (a Government), have published some app on the market (Google Play), and the encryption and description was working really well up to yesterday when I got the Jelly Bean 4.2 on my Nexus. The encrypt works fine, it's in fact encrypt the information to be stored. Though when decrypt it, I'm getting an exception exactly like this : pad block corrupted . I've checked the string and it's consistent with it on others devices (using the same

Python PyCrypto encrypt/decrypt text files with AES

走远了吗. 提交于 2019-12-18 10:21:37
问题 I already have a working program, but the only thing that doesn't work is the decrypt_file() function I have. I can still copy the encrypted text from the file and put it in my decrypt() function and have it work, but when I try to use my supposed-to-be handy decrypt_file() function it throws an error. Now I know 99.999% sure that my encrypt() and decrypt() functions are fine, but there is something with the bytes and strings conversion when I read and encode the text file that throws an

Help for AES-128 Bit Algorithm ?? i want to encrypt it

青春壹個敷衍的年華 提交于 2019-12-18 09:49:41
问题 Can i get link for AES-128 Bit Algorithm any sample code please help 回答1: AES-128 is already implemented in the Security framework and CommonCrypto API for the iPhone. This site contains some sample code using this to encrypt a message. You can also find sample code on Apple's website that makes use of this and provides some Objective-C wrappers. 回答2: Quite a few are written in C or C++ that you should be able to use in the iPhone, though I don't know of any that is written in Objective C as

AES encrypt with OpenSSL, decrypt with C# .Net

南笙酒味 提交于 2019-12-18 09:36:13
问题 I need to know how to encrypt a message in AES-OpenSSL and decrypt in .NET (C# or VB) OR Know what is the difference between AES-OPENSSL and AES-.NET Thank you! CODE in VB.NET : Public Function AES_Decrypt(ByVal prm_key As String, ByVal prm_iv As String, ByVal prm_text_to_decrypt As String) Dim sEncryptedString As String = prm_text_to_decrypt Dim myRijndael As New RijndaelManaged myRijndael.Padding = PaddingMode.Zeros myRijndael.Mode = CipherMode.CBC myRijndael.KeySize = 256 myRijndael

How to write AES/CBC/PKCS5Padding encryption and decryption with Initialization Vector Parameter for BlackBerry

こ雲淡風輕ζ 提交于 2019-12-18 09:12:38
问题 How to write a BlackBerry program for AES/CBC with Initialization Parameter ecncryption and Decryption and this encryption and decryption should work independent on Programming language Ex= If I encrypt some data using BlackBery I must be able to decrypt the same data using Java Program. Thanks Deepak 回答1: The decryption half of your question is answered here: decrypting data with AES/CBC/PKCS5Padding using blackberry It should be easy to figure out encryption using the same pattern (use

AES Encryption -Key Generation with OpenSSL

泄露秘密 提交于 2019-12-18 04:14:09
问题 As a reference and as continuation to the post: how to use OpenSSL to decrypt Java AES-encrypted data? I have the following questions. I am using OpenSSL libs and programming in C for encrypting data in aes-cbc-128. I am given any input binary data and I have to encrypt this. I learn that Java has a CipherParameters interface to set IV and KeyParameters too. Is there a way to generate IV and a key using openSSL? In short how could one use in a C program to call the random generator of openSSL