aes

C# Libraries to encrypt/decrypt using AES

[亡魂溺海] 提交于 2019-12-05 06:16:18
I couldn't find aes libraries in .net framework. Is there any external libraries? thanks You do not mention which version of the framework you are using, but since you did not immediately find System.Security.Cryptography.AesManaged , I guess you are using a version earlier than 3.5. Instead use System.Security.Cryptography.RijndaelManaged . Rijndael is the name of the algorithm that was standardized by NIST as AES. It is exactly the same algorithm (except that you can choose some blocklengths and modes with Rijndael that are not permitted with AES). You'll find AES built into the framework in

Initialization vector length in AES

若如初见. 提交于 2019-12-05 06:14:00
问题 I used AES with AES/CBC/PKCS5Padding with the following encryption and decryption code sections in Android: cipher.init(Cipher.ENCRYPT_MODE, keySpec, new IvParameterSpec(IV1)); cipher.init(Cipher.DECRYPT_MODE, keySpec, new IvParameterSpec(IV2)); where IV1 and IV2 are randomly generated 16-byte initialization vectors. I did this to check if the original and decrypted texts will be different using different IVs in encryption and decryption parties. This leads the bytes of the decrypted text to

JAVA AES 256 Decrypt [duplicate]

允我心安 提交于 2019-12-05 05:36:20
问题 This question already has answers here : InvalidKeyException Illegal key size (5 answers) Closed 2 years ago . I'm trying to decrypt with AES some data. I've been given a 256 bit key and 16 byte IV like these: String key = "Hh1s1f4T2mpN3yCh4ngeL8t3r\\.Thxpp"; int[] v = {11, 1, 555, 222, 241, 21, 11, 33, 35, 91, 45, 6, 14, 30, 22, 234}; String IV = Arrays.toString( v ); I've been told the padding should be PKCS7 but when I init the cipher with AES/CBC/PKCS7PADDING it says: Cannot find any

Node.js Crypto class returning different results with updated version

倖福魔咒の 提交于 2019-12-05 05:12:33
问题 The following code produces HTML output for a single-sign-on button that gets added to a page. In node version 0.5.x the key is accepted by the server on button click, but after upgrading to 0.10.x it does not work and produces a different output. No errors. Has the crypto class changed? Note, the key, url, and iv have been changed slightly to avoid posting secure information, but are the correct length. var util = require('util'); var crypto = require('crypto'); var fs = require('fs'); var

AES Rijndael on PHP server and iOS generates sometimes different ciphers

主宰稳场 提交于 2019-12-05 05:08:50
问题 I'm using NSData+AESCrypt category by Jim Dovey and NSString+AESCrypt by Michael Sedlaczek (2011-02-22). And on PHP I have a simple script: <?php $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = '01234567890123456789012345678901'; $plaintext = "myworda"; $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaintext, MCRYPT_MODE_ECB); $base64encoded_ciphertext = base64_encode($ciphertext); echo "ciphertext: ".

AES-256-CBC in Java

半世苍凉 提交于 2019-12-05 04:19:25
问题 I'm trying to write a simple Java program that will encrypt plain text with AES-256-CBC . There is class: import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class AesCBC { private byte[] key; private byte[] iv; private static final String ALGORITHM="AES"; public AesCBC(byte[] key, byte[] iv) { this.key = key; this.iv = iv; } public byte[] encrypt(byte[] plainText) throws Exception{ SecretKeySpec secretKey=new SecretKeySpec(key

What makes AES with Base64 generate different encryption result for the same plain text?

 ̄綄美尐妖づ 提交于 2019-12-05 03:55:15
问题 Here's a sample dummy code called test(), I run this 100K times and I get different encrypted messages for the same plain text (obviously, the decryption I get is the original plain text). I guess the reason behind this is to avoid frequency; but how come there can be MANY encryption to ONE decryption? shouldn't it be a one to one? public static void test() { String plainMessage = "I'm gonna bid 100 USD on this project"; String password = "A99922000001000004581F0F0CCD0000"; Set<String> set =

PBEWITHSHA256AND128BITAES-CBC-BC creating java.security.NoSuchAlgorithmException on RedHat 6.4

旧时模样 提交于 2019-12-05 03:53:54
We have an application that uses Bouncy Castle to encrypt data using PBEWITHSHA256AND128BITAES-CBC-BC algorithm. It works fine on Ubuntu running OpenJDK 1.7 . But when when we move it to RedHat 6.4 also running OpenJDK 1.7 , we get the following exception: java.security.NoSuchAlgorithmException Any thoughts on what could be causing this. How can we add PBEWITHSHA256AND128BITAES-CBC-BC algorithm to RedHat 6.4 ? p.s. the application is running in JBoss . private String cryptoAlgorithm = "PBEWITHSHA256AND128BITAES-CBC-BC"; Security.addProvider(new BouncyCastleProvider()); // load passPhrase from

JMeter入门9---Tcp sampler AES加密

Deadly 提交于 2019-12-05 03:14:29
JMeter入门9---Tcp sampler AES加密 Max.Bai 2018-06 压测tcp请求的时候需要对数据进行处理才发送,比如AES数据加密。实现方法可以有两种,一种自己写java请求,不使用默认tcp sampler, 第二种用默认的Tcp sampler,beanshell实现AES加密。 记录下beanshell实现过程。 1. 添加TCP Sampler EOL 设置为10 表示回车符号 2. 在TCP sampler添加 Add->Pre Process -> BeanShell PreProcess 3. 在BeanShell PreProcess 脚本里面添加如下代码。 AES 加密 import org.apache.jmeter.protocol.tcp.sampler.*; // tcp sample lib import org.apache.jmeter.samplers.*; // jmeter samplers lib import org.apache.jmeter.config.*; import com.alibaba.fastjson.JSON; //fastjson jar save in /lib/ext folder or load in testplan import com.alibaba.fastjson

Cannot decrypt AES-256 GCM with Java

喜夏-厌秋 提交于 2019-12-05 03:13:11
问题 I have a node module that can both encrypt and decrypt with AES-256 GCM. Now I am also trying to decrypt with Java whatever the node module encrypts, but I keep getting a AEADBadTagException. I have tested the node module by itself and can confirm that it works as intended. I know that Java assumes the authentication tag is the last part of the message, so I ensured that the tag is the last thing appended in the node module. Right now I'm just testing with the word, "hello". This is the