aes

BlackBerry Encryption AES 256 - No Padding

六月ゝ 毕业季﹏ 提交于 2019-12-13 07:51:26
问题 I want to encrypt data in BlackBerry using the AES 256 encryption method. The requirement is to encrypt with No Padding; " AES/ECB/NoPadding ". I am passing a 16 byte array and the encrypted data returned is a hex value of length 32. I have tried the following but it is not producing the correct result. The returned value is different from the expected encrypted value; tested in Android. The results between Android and BlackBerry do not tally. I have used the following method: public static

Porting C# AES 256 decryption to PHP

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 07:31:09
问题 I'm trying to port this C# code to PHP: private static string DecryptString(string content, string password) { Rijndael aes; byte[] retVal = null; byte[] contentBytes; byte[] passwordBytes; byte[] ivBytes; try { //Get the content as byte[] contentBytes = Convert.FromBase64String(content); //Create the password and initial vector bytes passwordBytes = new byte[32]; ivBytes = new byte[16]; Array.Copy(Encoding.Unicode.GetBytes(password), passwordBytes, Encoding.Unicode.GetBytes(password).Length)

Failure to decrypt an AES encrypted SMIME Message with OpenSSL

对着背影说爱祢 提交于 2019-12-13 06:31:46
问题 I have a two mails (SMIME encrypted) for a single recipient. One mail is encrypted using 3DES, the other one is encrypted using AES 256. The mails where created using C# EnvelopedCms class. I can successfully decrypt the 3DES message using openssl smime -decrypt -in trippledes.eml -inkey keyfile.pem However, if I try this with the AES encrypted file, OpenSSL outputs some gibberish and Fails with this comment: Error decrypting PKCS#7 structure 4128:error:06065064:digital envelope routines:EVP

Image Encryption & Decryption

a 夏天 提交于 2019-12-13 06:14:49
问题 I want to do encrypt and decrypt on image files. However, when i run this codes, it give me this error Exception in thread "main" java.lang.ClassCastException: javax.crypto.CipherInputStream cannot be cast to javax.imageio.stream.ImageOutputStream at encypt.com.trial.main(trial.java:82) and when i tried to open the sheepTest.png image, it cannot be open as the file appears to be damaged, corrupted or it is too large. I've tried many ways already, however I still cannot find the mistake.Can

Returning wrong decryption text when using invalid key

大憨熊 提交于 2019-12-13 05:24:57
问题 I use following class to encrypt/decrypt my texts. http://code.google.com/p/iphonebits/source/browse/trunk/src/Encryption/NSData-AES.m?r=2 This works perfectly. But when I decrypt the encrypted text with an invalid key (any one other than encryption key) this returns some text and its not in the actual length of the decrypted text. What can be the reason (is this supposed to return nil)? Is this the better way? Does libraries supposed to return errors for invalid decryption keys? Is it a must

Set padding in OpenSSL for AES_ecb_encrypt

大兔子大兔子 提交于 2019-12-13 05:11:25
问题 I'm decrypting some java encrypted text with OpenSSL. Reading this post I wrote the following code. unsigned int i = 0; printf("Out array - Before\n"); for(i = 0; i < sizeof(out); i++) { if(i % 32 == 0) printf("\n"); printf("%02X", out[i]); } printf("\n"); AES_set_decrypt_key((const unsigned char *)a.at(3).c_str(), 128, &aesKey_); for(i = 0; i < sizeof(bytes); i += AES_BLOCK_SIZE) { std::cout << "Decrypting at " << i << " of " << sizeof(bytes) << "\n"; AES_ecb_encrypt(bytes + i, out + i,

How to decrypt a field sent from client to Node server using CryptoJS?

情到浓时终转凉″ 提交于 2019-12-13 04:34:19
问题 I am trying to adapt the following solution into my Node application to decrypt a field sent from the client browser via POST: How to decrypt with CryptoJS using AES? Seem to be going round in circles in getting values to match in the console. The values for the encryption of 'hello' match both applied from Server and from client (sending 'hello' however there is now no decryption value showing for either. The server side code in a Node POST Route: var ENC_KEY = "c2VjcmV0"; //'secret' app

AES decode error when using a different AES instance

为君一笑 提交于 2019-12-13 03:59:19
问题 I am trying to decode an AES cipher in C#. If I use the same AES object as when I encode them, everything is fine. But as soon as I create a different instance of AES, it does not work: string original = "username,password,companyID"; byte[] encrypted; using (Aes myAes1 = Aes.Create()) { encrypted = EncryptStringToBytes_Aes(original, GetBytes("password"), myAes1.IV); //test1 string test1 = DecryptStringFromBytes_Aes(encrypted, GetBytes("password"), myAes1.IV); } using (Aes myAes2 = Aes.Create

AES encryption problem in Debug and Release mode

一曲冷凌霜 提交于 2019-12-13 02:30:01
问题 I am using AES encryption algorithm (Rijndael implementation). I am using MS Visual Studio 2008 IDE for my development work. I could see a strange problem in my Debug and Release mode. When I encrypt a string in Debug mode it generates different bytes than Release mode. But fortunately decrypting will result same string. I have tried in Mac, it generates one more byte sequence but able to decrypt all byte sequences correctly. Is this problem related to encryption algorithm or Debug/Release

How to create a .pem file with aes key

会有一股神秘感。 提交于 2019-12-13 01:43:17
问题 i have to create an aes-256 key and store it in a .pem file. I am using RAND_bytes() to simply create a 256 bit random key. After this how can i save this to a pem file. I have looked at Reading and writing rsa keys to a pem file in C and openssl pem. But i am not working with RSA keys. I suspect my task is much simpler like create pem from base64 but not much help. PS: This key will be used to encrypt a self signed digital certificate. EDIT: looking around more i found that i could use bio