aes

AES GCM encryption and decryption: PHP VS C# BouncyCastle

若如初见. 提交于 2021-02-20 03:38:29
问题 I am currently working on transforming my C# AES-GCM cryptography code to PHP. However, after some research, the text encrypted by my PHP system cannot be decrypted by the C# one. I want to know if there is any difference from both codes: C# with BouncyCastle: using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; using System; using System.IO; using System.Text; /

AES GCM encryption and decryption: PHP VS C# BouncyCastle

亡梦爱人 提交于 2021-02-20 03:38:09
问题 I am currently working on transforming my C# AES-GCM cryptography code to PHP. However, after some research, the text encrypted by my PHP system cannot be decrypted by the C# one. I want to know if there is any difference from both codes: C# with BouncyCastle: using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; using System; using System.IO; using System.Text; /

C# Encrypt/Decrypt from Java AES/CBC/PKCS5Padding

时光怂恿深爱的人放手 提交于 2021-02-20 02:21:02
问题 I'm facing an issue trying to Decrypt a string which has been encrypted in Java with the following properties (Java code) public static Builder getDefaultBuilder(String key, String salt, byte[] iv) { return new Builder() .setIv(iv) .setKey(key) .setSalt(salt) .setKeyLength(128) .setKeyAlgorithm("AES") .setCharsetName("UTF8") .setIterationCount(1) .setDigestAlgorithm("SHA1") .setBase64Mode(Base64.DEFAULT) .setAlgorithm("AES/CBC/PKCS5Padding") .setSecureRandomAlgorithm("SHA1PRNG")

C# Encrypt/Decrypt from Java AES/CBC/PKCS5Padding

守給你的承諾、 提交于 2021-02-20 02:14:53
问题 I'm facing an issue trying to Decrypt a string which has been encrypted in Java with the following properties (Java code) public static Builder getDefaultBuilder(String key, String salt, byte[] iv) { return new Builder() .setIv(iv) .setKey(key) .setSalt(salt) .setKeyLength(128) .setKeyAlgorithm("AES") .setCharsetName("UTF8") .setIterationCount(1) .setDigestAlgorithm("SHA1") .setBase64Mode(Base64.DEFAULT) .setAlgorithm("AES/CBC/PKCS5Padding") .setSecureRandomAlgorithm("SHA1PRNG")

C# Encrypt/Decrypt from Java AES/CBC/PKCS5Padding

主宰稳场 提交于 2021-02-20 02:14:11
问题 I'm facing an issue trying to Decrypt a string which has been encrypted in Java with the following properties (Java code) public static Builder getDefaultBuilder(String key, String salt, byte[] iv) { return new Builder() .setIv(iv) .setKey(key) .setSalt(salt) .setKeyLength(128) .setKeyAlgorithm("AES") .setCharsetName("UTF8") .setIterationCount(1) .setDigestAlgorithm("SHA1") .setBase64Mode(Base64.DEFAULT) .setAlgorithm("AES/CBC/PKCS5Padding") .setSecureRandomAlgorithm("SHA1PRNG")

Decrypt openssl AES 256 CBC in browser/CryptoJS

浪子不回头ぞ 提交于 2021-02-19 07:36:52
问题 I want to decrypt a string that has been encrypted with openssl on the server like this: openssl enc -e -aes-256-cbc -pbkdf2 -a -S 0123456789ABCDEF -A -k mypassword Note this is done providing only a salt and password, and openssl should handle key and IV automatically. Am I too optimistic that this can happen when the browser decrypts too? If at all possible, I want to do it with only those encryption settings, or the bare minimum of increased complexity. In the browser, I'm trying to

OpenSSL pads keys in aes encryption?

点点圈 提交于 2021-02-19 05:34:20
问题 I'm trying to use aes-128-cbc encryption with openssl, and I would expect that the key needs to be 32 digits. However, I noticed that when I put in a key length of 18, openssl does not give me an error. echo hello | openssl enc -aes-128-cbc -A -a -nosalt -K 123456789012345678 -iv 66666666666666666666666666666666 output:zBN+65infn74QK+prfY6kw== But if I add 0's after the key until it's 32 digits, I still get the same result. echo hello | openssl enc -aes-128-cbc -A -a -nosalt -K

how to 'Zero out' from memory an AES SecretKeySpec Key in Java

放肆的年华 提交于 2021-02-19 02:25:27
问题 I am using Java AES encryption using SecretKeySpec(byte[] key, String algorithm) to generate a Key object. After I encrypt something, I want to remove the Key from memory. I can remove all references to the Key, but that does not guarantee that the key is not floating somewhere in memory. I can "zero out" the byte[] array that I used to generate the Key, but how can I zero out or flush the actual Key memory. 回答1: There doesn't appear to be a way to do this in Java versions up to 7, but it has

Is it possible to implement AES with a 64-bit I/O block size?

↘锁芯ラ 提交于 2021-02-19 00:40:15
问题 I'm working on an application with a very specific encryption requirement: We are required to encrypt/decrypt individual 64-bit values, to protect certain parts of our internal architecture from reverse engineering through our public web endpoints. The problem is, the existing 64-bit encryption methods (such as 3DES) are not secure enough to meet our requirements (as far as I know). They also perform slower than AES, which is another painpoint. My question is, can we feasibly implement AES

AES use same IV for encryption and decryption

馋奶兔 提交于 2021-02-18 08:46:13
问题 I'm having some issues with my code whereby I am not using the same IV for encryption and decryption. I know in order to do this correctly I have to write the IV to my output file before the data however I am struggling implementing this. Could anyone help me with this issue? Edited code code again to show full scope public class TestFileEncryption { private static void mainCrypto(int cipherMode, File inputFile, File outputFile) throws Exception{ //Let the user enter the key they wish to use