aes

Java decryption of an encrypted file with openssl aes 256 cbc

爷,独闯天下 提交于 2019-11-29 23:59:20
问题 This question was migrated from Information Security Stack Exchange because it can be answered on Stack Overflow. Migrated 2 years ago . 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

python AES encryption java decryption

时光毁灭记忆、已成空白 提交于 2019-11-29 23:30:55
问题 I have over 1000 images and videos that need to be encrypted. Nothing over the top just something simple, I was thinking of using AES but what I cannot figure out is how to encrypt on my computer then decrypt the item on the device. I will be encrypting all the items on my computer probably using python. Then in an on demand fashion will decrypt the item with java (Android app) Any simple explanation will do pseudo code is fine too. The main issue im having is how to use the same key to

AES 256 encryption in C++ and Qt 5

房东的猫 提交于 2019-11-29 23:22:49
I have a Java code for encryption in place as follows! private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = null; if(isIVUsedForCrypto) { cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec, new IvParameterSpec(IV)); } else { cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); } byte[] encrypted = cipher.doFinal(clear); return encrypted; } public static byte[] toByte(String hexString) { int len = hexString.length()/2; byte[] result

AES ECB iOS Encrypt

醉酒当歌 提交于 2019-11-29 22:05:02
问题 I try to encrypt some string using AES algorithm with ECB option. size_t bufferSize = dataLength + kCCBlockSizeAES128; void *buffer = malloc(bufferSize); size_t numBytesEncrypted = 0; CCCryptorStatus cryptStatus = CCCrypt(kCCEncrypt, kCCAlgorithmAES128, kCCOptionECBMode, encryptionKey, kCCKeySizeAES128, NULL /* initialization vector (optional) */, [self bytes], dataLength, /* input */ buffer, bufferSize, /* output */ &numBytesEncrypted); if (cryptStatus == kCCSuccess) { return [NSData

关于AES256算法java端加密,ios端解密出现无法解密问题的解决方案

血红的双手。 提交于 2019-11-29 21:55:05
我想关于AES算法大家应该都已经了解了,我就不多介绍了。这是本人第一次写技术博文,如果有不对之处欢迎大家指正,共同讨论,一起学习! 之前在项目上用到AES256加密解密算法,刚开始在java端加密解密都没有问题,在iOS端加密解密也没有问题。但是奇怪的是在java端加密后的文件在iOS端无法正确解密打开,然后简单测试了一下,发现在java端和iOS端采用相同明文,相同密钥加密后的密文不一样!上网查了资料后发现iOS中AES加密算法采用的填充是PKCS7Padding,而java不支持PKCS7Padding,只支持PKCS5Padding。我们知道加密算法由算法+模式+填充组成,所以这两者不同的填充算法导致相同明文相同密钥加密后出现密文不一致的情况。那么我们需要在java中用PKCS7Padding来填充,这样就可以和iOS端填充算法一致了。 要实现在java端用PKCS7Padding填充,需要用到bouncycastle组件来实现,下面我会提供该包的下载。啰嗦了一大堆,下面是一个简单的测试,上代码! package com.encrypt.file; import java.io.UnsupportedEncodingException; import java.security.Key; import java.security.Security; import javax

Android 4.2 broke my AES encrypt/decrypt code

梦想的初衷 提交于 2019-11-29 21:54:49
It's my first time asking for help in here, my department (a Government), have published some app on the market (Google Play), and the encryption and description was working really well up to yesterday when I got the Jelly Bean 4.2 on my Nexus. The encrypt works fine, it's in fact encrypt the information to be stored. Though when decrypt it, I'm getting an exception exactly like this : pad block corrupted . I've checked the string and it's consistent with it on others devices (using the same key for test purposes), meaning it's exactly the same. The problem is that we need keep the back

SQL Server 2008 Open Master Key error upon physical server change over

自古美人都是妖i 提交于 2019-11-29 21:36:11
I copied a SQL Server database from one system to the next, identical setup, but completely different physical machine. I used Norton Ghost and recoverd files manually, for example, the entire SQL Server 2008 folder found in c:\Program Files after re-installing SQL Server 2008 Express. One of my databases has AES_256 encryption enabled on a number of one of its tables, columns. I resetup my IIS7 and tried to run the app that access the database, upon retrieving the data, I get this error: Server Error in '/' Application. Please create a master key in the database or open the master key in the

AES 256 Encryption: public and private key how can I generate and use it .net [closed]

帅比萌擦擦* 提交于 2019-11-29 20:21:00
Regarding AES 256 Encryption: What is the public and private key? How can I generate these two keys? How can I use the public to encrypt the data? How can I use the private to decrypt the data? In .Net, you can create your key pair like this: public static Tuple<string, string> CreateKeyPair() { CspParameters cspParams = new CspParameters { ProviderType = 1 }; RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024, cspParams); string publicKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(false)); string privateKey = Convert.ToBase64String(rsaProvider.ExportCspBlob(true)

Storing passwords with Node.js and MongoDB

核能气质少年 提交于 2019-11-29 19:35:07
I'm looking for some examples of how to securely store passwords and other sensitive data using node.js and mongodb. I want everything to use a unique salt that I will store along side the hash in the mongo document. For authentication do I have to just salt and encrypt the input and match it to a stored hash? Should I ever need to decrypt this data and if so how should I do it? How are the private keys, or even salting methods securely stored on the server? I've heard the AES and Blowfish are both good options, what should I use? Any examples of how to design this would be wonderfully helpful

信息安全-加密:AES 加密

人走茶凉 提交于 2019-11-29 18:15:40
ylbtech-信息安全-加密:AES 加密 高级加密标准(英语:Advanced Encryption Standard,缩写:AES),在 密码学 中又称Rijndael加密法,是 美国联邦政府 采用的一种区块加密标准。这个标准用来替代原先的 DES ,已经被多方分析且广为全世界所使用。经过五年的甄选流程,高级加密标准由 美国国家标准与技术研究院 (NIST)于2001年11月26日发布于FIPS PUB 197,并在2002年5月26日成为有效的标准。2006年,高级加密标准已然成为 对称密钥加密 中最流行的算法之一。 1. 返回顶部 AES加密 AES加密是对称加密、分组加密;密钥长度 分为128位、192位、256位;对应的数据分组也应该分为128位 192位 256位;这三种加密的轮次是不一样的。分别是:10、12、14 加密过程: ① 由原始数据 转为 输入state(二维矩阵 对于选择128位加密,就是4×4矩阵) ② 初始变换   就是进行轮密钥加(密钥轮加在后面介绍) ③ 循环N轮的变换   其中 N-1轮变换如下:   字节代换——》行位移——》列混淆——》轮密钥加   字节代换,就是基于S盒原理进行,上面有,不多说了!   行位移:第一行不变,第二行循环左移一个字节,第三行循环左移两个字节,第四行循环左移三个字节   列混淆