aes

AesEncryption doesn't appear to decrypt right?

五迷三道 提交于 2019-12-11 07:54:29
问题 I wrote this class to allow me to encrypt and decrypt the json representation of objects but it doesn't appear to work as the MSDN documentation (here: https://msdn.microsoft.com/en-us/library/system.security.cryptography.aesmanaged%28v=vs.95%29.aspx?f=255&MSPPError=-2147217396) suggests it should ... using Newtonsoft.Json; using System; using System.Configuration; using System.IO; using System.Security.Cryptography; using System.Text; using System.Web.Configuration; namespace Core.Data {

What is the Key Length of the des-ede-cbc cipher?

笑着哭i 提交于 2019-12-11 07:33:09
问题 I know that DES has a key length of 56, but what does the ede mean and does it effect the key length? Openssl des-ede-cbc 回答1: Triple DES, DES-EDE or TDEA (formally speaking) can be used with no less than 3 key sizes. The most logical form uses 3 separate keys for each of the phases (Encrypt, Decrypt and then Encrypt again, which is the meaning of EDE). It has a key size of 3 times 56 bits or 168 bits, but those are usually encoded with parity bits (the least significant bit of each byte),

CryptoJS encrypt Go decrypt

做~自己de王妃 提交于 2019-12-11 06:29:44
问题 I have the following Go code ciphertext := "Zff9c+F3gZu/lsARvPhpMau50KUkMAie4j8MYfb12HMWhkLqZreTk8RPbtRB7RDG3QFw7Y0FXJsCq/EBEAz//XoeSZmqZXoyq2Cx8ZV+/Rw=" decodedText, _ := base64.StdEncoding.DecodeString(ciphertext) decodedIv, _ := base64.StdEncoding.DecodeString("u9CV7oR2w+IIk8R0hppxaw==") newCipher, _ := aes.NewCipher([]byte("~NB8CcOL#J!H?|Yr")) cfbdec := cipher.NewCBCDecrypter(newCipher, decodedIv) cfbdec.CryptBlocks(decodedText, decodedText) data, _ := base64.StdEncoding.DecodeString

correct nonce/iv size for AES-GCM mode

天大地大妈咪最大 提交于 2019-12-11 06:14:53
问题 EDIT: The issue can be simplified to this : The following Node.js code give an "Invalid IV length" Error. Why? What should the IV be? const crypto = require('crypto') const decipher = crypto.createDecipheriv('aes-128-gcm', crypto.randomBytes(16), crypto.randomBytes(16)) I'm using AES in GCM mode to encrypt some data, but I'm using two different languages and libraries for encryption and decryption and they seem to have different vocabularies about what I need. I'm encrypting with a Python

Openssl/libcrypto AES 128 encoding using the KEY

萝らか妹 提交于 2019-12-11 05:48:35
问题 I am encrypting a certain string using AES-128-ECB and then save the result in a file e.g test.enc Here is my method that does the encryption: int do_crypt(char *outfile) { unsigned char outbuf[1024]; int outlen, tmplen; unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; char intext[] = "Some Text"; EVP_CIPHER_CTX ctx; FILE *out; EVP_CIPHER_CTX_init(&ctx); EVP_EncryptInit_ex(&ctx, EVP_aes_128_ecb(), NULL, key, NULL); if(!EVP_EncryptUpdate(&ctx, outbuf, &outlen, intext, strlen

Java AES-256 Decryption - translating code from ActionScript 3

故事扮演 提交于 2019-12-11 05:39:47
问题 I have a working decryption in ActionScript 3, now I want to get the same result when decrypting in Java. (I know that the OFB-mode and NullPadding is probably not preferred, but that's what I used back then and that is what I need to decrypt now...) (very old) Adobe ActionScript 3 code: static public function decryptTest(): Boolean { var iv: String = "0df1eff724d50157ab048d9ff214b73c"; var cryptext: String =

Saving key and iv to file AES implementation Crypto++

ぃ、小莉子 提交于 2019-12-11 05:15:01
问题 So I am using the Crypto++ Library to encrypt a file. I need to save the key and iv for future use. I am following this tutorial. Here is my function : void AESUtil::encrypt(string filename,bool savekeys,string savefilename){ AutoSeededRandomPool rnd; // Generate a random key byte key[AES::DEFAULT_KEYLENGTH]; rnd.GenerateBlock(key, AES::DEFAULT_KEYLENGTH); // Generate a random IV byte iv[AES::BLOCKSIZE]; rnd.GenerateBlock(iv, AES::BLOCKSIZE); Binary b; string plaintext = b.decoder(filename);

Encrypt AesCryptoServiceProvider return zero byte array?

断了今生、忘了曾经 提交于 2019-12-11 05:13:37
问题 I encounter an error when using the AesCryptoServiceProvider to Encrypt some files config. The summary code is below private static byte[] secretKey = { (byte)0x63, (byte)0x23, (byte)0xdf, (byte)0x2a, (byte)0x59, (byte)0x1a, (byte)0xac, (byte)0xcc, (byte)0x50, (byte)0xfa, (byte)0x0d, (byte)0xcc, (byte)0xff, (byte)0xfd, (byte)0xda, (byte)0xf0 }; private static byte[] iv = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; public

Using AES in CBC with the same IV for messages

﹥>﹥吖頭↗ 提交于 2019-12-11 05:03:54
问题 Will encrypting two identical plaintext messages with AES in CBC with the same IV yield the same ciphertext? From my understanding the first block is XOR'd with the IV, and then each subsequent block with the previous. Does this mean that with the same IV and identical messages that every block will be encrypted to the same thing? I understand using a predictable or non-changing IV for encryption is a very bad thing to do, and I am wondering why - is it because attackers can build up a "book"

Rijndael/AES decryption C# to PHP conversion

纵然是瞬间 提交于 2019-12-11 04:32:55
问题 I have the following code in C# string s = "hellowld"; byte[] bytes = new UnicodeEncoding().GetBytes(s); FileStream stream = new FileStream(inputFile, FileMode.Open); RijndaelManaged managed = new RijndaelManaged(); CryptoStream stream2 = new CryptoStream(stream, managed.CreateDecryptor(bytes, bytes), CryptoStreamMode.Read); FileStream stream3 = new FileStream(outputFile, FileMode.Create); try { int num; while ((num = stream2.ReadByte()) != -1) { stream3.WriteByte((byte) num); } [....] This