aes

Cocoa encryption plain text?

扶醉桌前 提交于 2019-12-08 06:05:32
问题 I'm working on an encryption application that for now encrypts text-only files. I need some help in the connections and how to go about the actual encryption. I received this snippet of code to encrypt a file, but I am a bit confused. What I need to do is have a button (encrypt) that takes this text file and encrypts it. Am I supposed to extract the contents of the file first, then encrypt it? How so? The program must know what file has been selected so it encrypts it, and I'm a complete noob

AesZipFileEncrypter zipAndEncrypt method adds all folder tree to file

谁都会走 提交于 2019-12-08 05:09:48
问题 I'm using this method to zip and decrypt a file: AesZipFileEncrypter.zipAndEncrypt This code: AesZipFileEncrypter.zipAndEncrypt(new File("C:\Test\Folder\MyFile.txt"), new File("C:\Test\Folder\MyZip.zip"), password, aesEncrypter); compresses also the folder tree of my file, not just the file. For example: Adding C:\Test\Folder\MyFile.txt in the created zip file I will find the folders C:\Test\Folder\MyFile.txt also if I would like to have just MyFile.txt in the root folder. Is it possibile?

My AES encryption/decryption functions don't work with random ivecs

会有一股神秘感。 提交于 2019-12-08 04:22:01
问题 I was bored and wrote a wrapper around openSSL to do AES encryption with less work. If I do it like this: http://pastebin.com/V1eqz4jp (ivec = 0) Everything works fine, but the default ivec is all 0's, which has some security problems. Since I'm passing the data back as a string anyway, I figured, why not generate a random ivec and stick it to the front, the take it back off when I decrypt the string? For some reason it doesn't work though. Well actually, it almost works. It seems to decrypt

iPhone: Encrypt Nsstring using AES 128 and Decrypt

北城余情 提交于 2019-12-08 04:00:31
I am new to Encryption/ Decryption. I want to encrypt a NSString variable value using key. Also I want to decrypt the encrypted data . I want to apply AES -128 Algorithm. Please suggest sample code or useful link. Alex Reynolds I found this through a Google search on the terms aes nsstring site:stackoverflow.com : AES Encryption for an NSString on the iPhone 来源: https://stackoverflow.com/questions/2808568/iphone-encrypt-nsstring-using-aes-128-and-decrypt

How to decrypt aes-256-cbc in Java

十年热恋 提交于 2019-12-08 03:04:14
问题 I have encrypted the string in php. Decrypted successfully from php and node.js. In addition, it must be decrypted by java. Help me an example of decrypting from java? PHP Encrypt code /* encrypt */ $encryption_method = 'aes-256-cbc'; $secretHash = "d95acd54c6a821ff32c52825b931c194"; $iv_size = openssl_cipher_iv_length($encryption_method); $iv = openssl_random_pseudo_bytes($iv_size); //encrypt $encryptedMessage = openssl_encrypt($new_token, $encryption_method, $secretHash, 0, $iv); /

Error when decrypt input data longer than 15 chars with AES256 and Node.js

烈酒焚心 提交于 2019-12-08 02:50:05
问题 I'm writing my own security class using the crypto module of Node.js and the AES-256-CBC cipher algorithm. But when I try to decrypt an encrypted string, encrypted from input data longer than 15 characters, fails with this error: crypto.js:153 var ret = this._handle.final(); Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt I think that the problem is with the encryption or the IV generation, in fact, the encrypted hex string is always 32 chars long. Let's review

Issues with encrypting a file using openssl evp api(aes256cbc)

十年热恋 提交于 2019-12-08 02:43:20
问题 I am trying to read a file(.txt) in this case and encrypting/decrypting it with AES256CBC using EVP api of openssl. (read(plain.txt)->create(encrypt.txt)->create(decrypt.txt)) # include <stdio.h> # include <stdlib.h> # include <openssl/evp.h> # include <openssl/aes.h> # include <sys/types.h> # include <sys/stat.h> # include <fcntl.h> # include <unistd.h> # include <string.h> # include <assert.h> # include <error.h> # include "debug.h" # define SIZE 32 char buf[SIZE]; int aes_init(unsigned

Which AES library to use in Ruby/Python?

青春壹個敷衍的年華 提交于 2019-12-08 02:04:38
问题 I need to be able to send encrypted data between a Ruby client and a Python server (and vice versa) and have been having trouble with the ruby-aes gem/library. The library is very easy to use but we've been having trouble passing data between it and the pyCrypto AES library for Python. These libraries seem to be fine when they're the only one being used, but they don't seem to play well across language boundaries. Any ideas? Edit: We're doing the communication over SOAP and have also tried

AES-Encrypt-then-MAC a large file with .NET

馋奶兔 提交于 2019-12-08 01:50:56
问题 I want to encrypt a large file (lets say 64 GB) in the most efficient way in .NET. How I would implement this: Create an instance of AesManaged to encrypt the stream of the file (read 64 GB) Save this stream to disk (because it is to big to hold in memory) (write 64 GB) Create an instance of HMACSHA512 to compute hash of the saved file (read 64 GB) Save encrypted data with iv to disk (read & write 64 GB) Simplified C# Code: using (var aesManaged = new AesManaged()) { using (var msEncrypt =

DCPCrypt/Delphi not properly encoding Rijndael

隐身守侯 提交于 2019-12-07 23:48:13
问题 I have the DCPCrypt package (latest version) and am trying to do AES/Rijndael CBC encoding (128 bit blocks, 256 bit key) in Delphi2007 with test values from the AES Known Answer Test (KAT) Vectors distributed by NIST. One sample test vector: KEY = 0000000000000000000000000000000000000000000000000000000000000000 IV = 00000000000000000000000000000000 PLAINTEXT = 80000000000000000000000000000000 CIPHERTEXT = ddc6bf790c15760d8d9aeb6f9a75fd4e The code below returns: Cyphertext (bytes): 58 215 142