aes

AES: how to detect that a bad password has been entered?

五迷三道 提交于 2019-12-22 01:17:20
问题 A text s has been encrypted with: s2 = iv + Crypto.Cipher.AES.new(Crypto.Hash.SHA256.new(pwd).digest(), Crypto.Cipher.AES.MODE_CFB, iv).encrypt(s.encode()) Then, later, a user inputs the password pwd2 and we decrypt it with: iv, cipher = s2[:Crypto.Cipher.AES.block_size], s2[Crypto.Cipher.AES.block_size:] s3 = Crypto.Cipher.AES.new(Crypto.Hash.SHA256.new(pwd2).digest(), Crypto.Cipher.AES.MODE_CFB, iv).decrypt(cipher) Problem: the last line works even if the entered password pw2 is wrong . Of

AES 256 in Blackberry

纵然是瞬间 提交于 2019-12-22 01:03:44
问题 How can I do AES 256 encryption in Blackberry... I am using for encryption : but not get data AES256 standard : private static byte[] encrypt( byte[] keyData, byte[] data ) throws CryptoException, IOException { // Create the AES key to use for encrypting the data. // This will create an AES key using as much of the keyData // as possible. AESKey key = new AESKey( keyData ); // Now, we want to encrypt the data. // First, create the encryptor engine that we use for the actual // encrypting of

Salting with AES

自闭症网瘾萝莉.ら 提交于 2019-12-22 00:34:00
问题 I'm a bit of an encryption newbie, but need to encrypt sensitive personal data before storing in a database. I was planning to use AES with CBC, but also wanted to use a salt. I couldn't however find a way to do this (other than with BouncyCastle which my host is not prepared to allow for some reason) so I decided to add one myself by adding a random string to end of the text to be encrypted: SecretKeySpec skeySpec = new SecretKeySpec(key, "AES"); byte[] iv = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

Openssl AES 256 CBC Java Decrypt File with salt

本小妞迷上赌 提交于 2019-12-22 00:31:42
问题 I have been trying for several days to decrypt in java a message encrypted with openssl. The message was encrypted with the following command: openssl enc -e -aes-256-cbc -kfile $ file.key -in toto -out toto.enc. The file file.key contains the symmetric key of 256 bits. No salt has been specified in the command and yet the file begins with Salted__. Here is the class that I coded to try to decrypt the file but impossible to get anything even by removing the 16 characters of the file namely

BLOB data returned in MySQL using AES_DECRYPT with ORDER clause

ⅰ亾dé卋堺 提交于 2019-12-22 00:05:26
问题 I'm creating a system in which users can store messages via PHP with a MySQL database, and I am using the MySQL AES_ENCRYPT function to encrypt the contents of these messages. Here is my posts table: CREATE TABLE IF NOT EXISTS `posts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user` int(11) DEFAULT NULL, `group` int(11) DEFAULT NULL, `body` varbinary(1000) NOT NULL, `ip` varchar(45) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `replyto` int(11) DEFAULT NULL, PRIMARY KEY (`id`)

How should I derive the key and initialization vector for my AES encrypted database entries?

久未见 提交于 2019-12-21 22:14:04
问题 I've built a CMS system to allow users to create and manage online forms on my client's intranet app. Of course some of the data handled by the forms may need to be encrypted e.g. if the system is used to build a form that handles salary specifics or whatever. So I'm using the AESManaged class to symmetrically encrypt this sort of data prior to it going into our application db. All is fine, but now, prior to release, I could do with a steer regarding the shared secret and salt . My original

How do I do a cross platform encryption method working in both IOS and android (AES encryption only..)?

核能气质少年 提交于 2019-12-21 22:03:46
问题 I have been recently assigned a task of encrypting my links and parameters i pass in dataTaskWithRequest in swift. The main headache is it should produce the same output as Android platform. The android team has already created a backend using spring for decrypting the data. The java code is like this class AESencrp { private static final String ALGO = "AES"; private static final byte[] keyValue = new byte[]{'T', 'h', 'e', 'B', 'e', 's', 't', 'S', 'e', 'c', 'r', 'e', 't', 'K', 'e', 'y'};

lua aes encryption

吃可爱长大的小学妹 提交于 2019-12-21 21:43:54
问题 I found a "lua aes" solution on the web a while ago. And have some concern about its safety. It states that: -- Do not use for real encryption, because the password is easily viewable while encrypting. It says this at its "file encryption test" script. My questions are: Why is that, how is it any different from encrypting a string and writing it to a file? How could it be viewable while encryption? Is it viewable after encryption too? Basically, Is it safe to use or not? Is there anyone who

Javascript <-> Java AES

守給你的承諾、 提交于 2019-12-21 21:41:41
问题 I'm attempting to write a web app that uses AES encryption over AJAX to interact with a Java backend. I've spent some time looking for and testing libraries and none of them have proven fruitful. I have Java <-> PHP working correctly with the following Java code: public static String encrypt(String input, String key){ IvParameterSpec ips = new IvParameterSpec("sixteenbyteslong".getBytes()); try { key = md5(key); } catch (NoSuchAlgorithmException e1) { e1.printStackTrace(); } byte[] crypted =

How can i add more algorithm in cryptoAPI in linux

人盡茶涼 提交于 2019-12-21 20:24:32
问题 When i check /proc/crypto it shows me: abhi@ubuntu:/proc$ cat crypto name : stdrng driver : krng module : kernel priority : 200 refcnt : 1 selftest : passed type : rng seedsize : 0 name : md5 driver : md5-generic module : kernel priority : 0 refcnt : 1 selftest : passed type : shash blocksize : 64 digestsize : 16 I need to use aes256 for one of my projects. Can someone point out how I can add this algo to crypto api or is there any other way i can achieve this in (ubuntu 10.4, 2.6.32-35). Is