aes

AES/CFB8 IV size

扶醉桌前 提交于 2020-01-02 12:09:28
问题 AFAIK, CFB8 mode has block size of 1byte. So I can induce that IV is also 1byte length. However, when I do a test passing same iv of just 1 byte into common crypto create function for encrypt and decrypt function, encrypted and decrypted message mismatch. So I think that the API should have taken more than 1 byte to use as IV. I would like to know why? Any thing wrong with my understanding? CCCryptorStatus result = CCCryptorCreateWithMode(operation, kCCModeCFB8, kCCAlgorithmAES128,

Where should one store the cipher key when using AES encryption with PHP?

这一生的挚爱 提交于 2020-01-02 11:48:10
问题 I am implementing AES-256 bit encrpytion in my web app: http://www.utoxin.name/2009/07/automatic-db-field-encryption-in-cakephp/ One of the steps says to store the cipher used and key in a boostrap file. But what is stopping someone from scanning the file system with PS or something and decrypting the data? What is the best way to secure the data? 回答1: If someone has access to all files on the hard drive of your server, all bets are off. There is no way you can protect your data then, because

Hard coded AES-256 key with WinCrypt & CryptImportKey

允我心安 提交于 2020-01-02 07:25:13
问题 I need to have a Win32 application load a hard coded AES-256 key, ideally using the WinCrypt.h methods. I've got my key in an unsigned char[32] but I can't find the correct format of a key blob to pass to CryptImportKey. Everything seems to give me invalid parameter errors. Is there any way to do this? (Also important is how to set IV in WinCrypt. I can't see how to do that at all) 回答1: Solved it. I was using the wrong bType and using 256 for keySize instead of 32. BYTE myPrivateKey[] = {1,2

Using SharpAESCrypt to encrypt strings

*爱你&永不变心* 提交于 2020-01-02 07:18:09
问题 I decided to use the SharpAESCrypt implementation of AES encryption in C#. According to their documentation (https://www.aescrypt.com/sharp_aes_crypt.html) you should be able to use a static method, providing a password string, plain-text input stream and a output stream. The data I get out of my output stream appears to be all zero's. I suspect I am doing something wrong converting strings to a stream and back. Can anyone see anything that is obviously wrong with the code below? (It compiles

PHP AES Decryption working Encryption NOT

给你一囗甜甜゛ 提交于 2020-01-02 07:16:13
问题 So, I have 3 Pieces out of 4 working, iOS Encrypt-Decrypt from this Link And I am able to Decrypt the data Encrypted from iOS I am having trouble Encrypting on PHP side. When I do echo Encryption code. PHP prints something like F>HFl8aR what does it mean ? SALTKEY = 'a16byteslongkey!'; Decryption Code: Working $result = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, (SALTKEY . str_repeat(chr(0x00), 16)), base64_decode($text), 'ecb'); $pad_char = ord(substr($result, -1)); return substr($result,

Decrypt in Golang what was encrypted in Python AES CFB

。_饼干妹妹 提交于 2020-01-02 07:03:41
问题 Based on the Golang documentation on CFB decryption I wrote a minimal working example to decrypt a string that was encrypted with AES CFB and then base 64 encoded in python3. The golang decryption works fine when the message was encrypted within Golang (with the encryption function from the Golang doc example). However when I encrypt the message in a python script using the python crypto package, I am unable to decrypt it in the golang script successfully. I don't get the right bytes back. $

Encrypt in javascript and decrypt in C# with AES algorithm

我们两清 提交于 2020-01-01 18:53:06
问题 I tried to encrypt in angular using AES librery from AES. I encrypt string using the CryptoJS.AES.encrypt() method from AES. here my code: var txtloginKod = 'Some String...'; var key = CryptoJS.enc.Utf8.parse('8080808080808080'); var iv = CryptoJS.enc.Utf8.parse('8080808080808080'); var encryptedlogin = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(txtloginKod), key, { keySize: 128 / 8, iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); The method CryptoJS.AES.encrypt() return a

Encrypt in javascript and decrypt in C# with AES algorithm

Deadly 提交于 2020-01-01 18:51:04
问题 I tried to encrypt in angular using AES librery from AES. I encrypt string using the CryptoJS.AES.encrypt() method from AES. here my code: var txtloginKod = 'Some String...'; var key = CryptoJS.enc.Utf8.parse('8080808080808080'); var iv = CryptoJS.enc.Utf8.parse('8080808080808080'); var encryptedlogin = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(txtloginKod), key, { keySize: 128 / 8, iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); The method CryptoJS.AES.encrypt() return a

Decrypt string in java which was encrypted using AES in php

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 07:22:35
问题 <?php # --- ENCRYPTION --- # the key should be random binary, use scrypt, bcrypt or PBKDF2 to # convert a string into a key # key is specified using hexadecimal $length = 16; $key = openssl_random_pseudo_bytes($length); // echo $key; // $key = pack('H*', "bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3"); echo $key."<br/>"; echo "<br/>"; # show key size use either 16, 24 or 32 byte keys for AES-128, 192 # and 256 respectively $key_size = strlen($key); echo "Key size: " . $key

Need advice about AES CTR cipher python vs. Java

痴心易碎 提交于 2020-01-01 07:12:46
问题 I'm working on project when some arbitrary data are encrypted using Python simple-crypt (source here) and same encrypted data are then used in java application. I would like to understand conceptual difference between JSSE and Pycrypto. This is python part doing encryption (source): counter = Counter.new(HALF_BLOCK, prefix=salt[:HALF_BLOCK//8]) cipher = AES.new(cipher_key, AES.MODE_CTR, counter=counter) This is my attempt for java re-implementation of same operation: SecretKeySpec key = new