aes

AES Encrypt/Decrypt Delphi & PHP

僤鯓⒐⒋嵵緔 提交于 2019-12-17 19:37:23
问题 My Delphi application uses TurboPower LockBox 3 to encrypt a plaintext information using AES 256. I now want to decrypt this information using PHP. But TurboPower LockBox 3 has some interoperability issues. Please check the post by LockBox 3 author here for details : http://lockbox.seanbdurkin.id.au/tiki-view_forum_thread.php?comments_parentId=363&topics_offset=1 And a similar post on Stackoverflow Secure keypair encryption solution in Delphi & PHP? In LockBox 3, during encryption, you set a

Generating random IV for AES in Java

99封情书 提交于 2019-12-17 18:11:32
问题 I'm implementing and AES encryption engine for PBE in android, and I've found two ways to implement the creation of the IV and I would like to know which one is better and more secure for getting IvParameterSpec : Method #1: SecureRandom randomSecureRandom = SecureRandom.getInstance("SHA1PRNG"); byte[] iv = new byte[cipher.getBlockSize()]; randomSecureRandom.nextBytes(iv); IvParameterSpec ivParams = new IvParameterSpec(iv); Method #2: AlgorithmParameters params = cipher.getParameters(); byte[

Java using AES 256 and 128 Symmetric-key encryption

末鹿安然 提交于 2019-12-17 17:35:49
问题 I am new in cipher technology. I found this code to do Symmetric Encryption. byte[] key = //... secret sequence of bytes byte[] dataToSend = ... Cipher c = Cipher.getInstance("AES"); SecretKeySpec k = new SecretKeySpec(key, "AES"); c.init(Cipher.ENCRYPT_MODE, k); byte[] encryptedData = c.doFinal(dataToSend); Its working. Here I can use my own password. And thats what exactly I needed. But I dont know how to do 128 or 256 Symmetric Enctryption. How can I use 128 and 256 key into my code ? 回答1:

Java AES encryption and decryption

久未见 提交于 2019-12-17 17:33:37
问题 I would like to encrypt and decrypt a password using 128 bit AES encryption with 16 byte key. I am getting javax.crypto.BadPaddingException error while decrypting the value. Am I missing anything while decrypting? public static void main(String args[]) { Test t = new Test(); String encrypt = new String(t.encrypt("mypassword")); System.out.println("decrypted value:" + t.decrypt("ThisIsASecretKey", encrypt)); } public String encrypt(String value) { try { byte[] raw = new byte[]{'T', 'h', 'i',

Padding is invalid and cannot be removed Exception while decrypting string using “AesManaged” C#

拟墨画扇 提交于 2019-12-17 16:59:19
问题 Please suggest me where i need to update/refactor the code to get rid of exception. I am getting exception while I try to decrypt the encrypted string using following code. Following line is throwing exception using (StreamReader srDecrypt = new StreamReader(csDecrypt)) { // Read the decrypted bytes from the decrypting stream // and place them in a string. plaintext = srDecrypt.ReadToEnd(); } public string EncryptAuthenticationTokenAes(string plainText) { byte[] encrypted; // Create an

How to do AES decryption using OpenSSL

一世执手 提交于 2019-12-17 15:44:52
问题 I'd like to use the OpenSSL library to decrypt some AES data. The code has access to the key. This project already uses libopenssl for something else, so I'd like to stick to this library. I went looking directly into /usr/include/openssl/aes.h since the OpenSSL site is light on documentation. The only decrypt function is this one: void AES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key); Unfortunately, this doesn't have a way to specify the length of the in pointer,

AES encryption on large files

人走茶凉 提交于 2019-12-17 15:43:27
问题 I need to encrypt and decrypt large file (~1GB). I tried using this example: http://www.codeproject.com/Articles/769741/Csharp-AES-bits-Encryption-Library-with-Salt But my problem is since the file is very large, I'm getting outOfMemory exception. So I need to replace the memory stream with file stream, I just not sure how to do it... (Adding my code:) private static void AES_Encrypt(string srcFile, string encryptedFile, byte[] passwordBytes) { // Set your salt here, change it to meet your

Unable to exchange data encrypted with AES-256 between Java and PHP

时光怂恿深爱的人放手 提交于 2019-12-17 15:42:15
问题 My problem is: what I encrypt in Java I can decrypt perfectly in Java, but PHP mcrypt can't decrypt. What I encrypt with mcrypt I can decrypt with mcrypt , but can't in Java. I want to send and receive encrypted data from a Java application to a PHP page, so I need it to be compatible. Here's what I have... JAVA... public static String crypt(String input, String key){ byte[] crypted = null; try{ SecretKeySpec skey = new SecretKeySpec(Base64.decodeBase64(key), "AES"); Cipher cipher = Cipher

How to decrypt message with CryptoJS AES. I have a working Ruby example

此生再无相见时 提交于 2019-12-17 15:34:50
问题 I'm able to decrypt AES encrypted message with Ruby like this: require 'openssl' require 'base64' data = "IYkyGxYaNgHpnZWgwILMalVFmLWFgTCHCZL9263NOcfSo5lBjAzOZAtF5bF++R0Bi+9c9E+p3VEr/xvj4oABtRWVJ2wlWzLbYC2rKFk5iapFhb7uZCUpO4w4Su3a5QFa2vInjYueziRoqySZd/DpstMJ8rsJ94VGizFFFZ1l0sw1ax+wfBAv5+wHs/hlnHi/ea66KBO3rgXKahvV28h+4bh5etc8RCrmiiNbfg6Oj0jQJDjdYIdW8T9YPOI9E1hih8lbfRnMWcOFJgYekfLpoy5LI525UGnlM46J1k6ekLqsn9FqvbiOOoLgqa4YqBm1i9P0ePyjkME+t+RiL8xXX+ItgOYr9G7kM64wlTJPCW8B/crmUdmGzQNC/hD/u

Getting SlowAES and RijndaelManaged class in .NET to play together

廉价感情. 提交于 2019-12-17 10:43:37
问题 I'm trying to setup AES encryption / decryption using the javascript library SlowAES and the RijndaelManaged class in .NET. I chose this method after reading this post, where Cheeso has managed to get these two encryption methods to play together "In my tests of the COM-wrapped-SlowAEs, I used CBC mode, and the encryption was completely compatible with the RijndaelManaged class in .NET" - Cheeso I've taken the javascript code from Cheeso's Windows Scripting Component, the latest slowaes