encryption

Decrypting OpenSSL-encrypted file on Android with Java

左心房为你撑大大i 提交于 2021-02-06 14:05:43
问题 I'm currently trying to implement file decryption on my Android app. The file will be encrypted on host(Linux) using something like : openssl aes-128-ecb -salt -k $HASH -in somefile.in -out somefile openssl aes-256-cbc -salt -K $HASH -iv $IV -md sha1 -in somefile.in -out somefile openssl aes-256-cbc -d -salt -K $HASH -md sha1 -in somefile.in -out somefile The problem is that, I CANNOT get any of these combinations(128/256, ecb/cbc, salt/nosalt, -K/-k, -md/none) to properly decrypt on Android.

RSA Encryption in Javascript with existing DER / PEM keys

╄→尐↘猪︶ㄣ 提交于 2021-02-06 13:58:35
问题 my first post. I'm trying to asymmetrically encrypt data in JavaScript (in the user's browser), using the existing public key that I've used to successfully encrypt data in our native iOS and Android app. I created the keys this way: openssl req -x509 -out public_key.der -outform der -new -newkey rsa:1024 -keyout private_key.pem -days 3650 (Thanks to http://jslim.net/blog/2013/01/05/rsa-encryption-in-ios-and-decrypt-it-using-php/) When I use these wonderful JavaScipt examples: Example.

Replacing JAVA with PHP for PKCS5 encryption

∥☆過路亽.° 提交于 2021-02-06 11:30:08
问题 I have been tasked with replacing a legacy java system with something which runs PHP. I am getting a little stuck on replacing the java cryptography with PHP code. cipherAlgorythm = "PBEWithMD5AndDES"; cipherTransformation = "PBEWithMD5AndDES/CBC/PKCS5Padding"; PBEParameterSpec ps = new javax.crypto.spec.PBEParameterSpec(salt, iterations); SecretKeyFactory kf = SecretKeyFactory.getInstance(cipherAlgorythm); SecretKey key = kf.generateSecret(new javax.crypto.spec.PBEKeySpec(password

Replacing JAVA with PHP for PKCS5 encryption

馋奶兔 提交于 2021-02-06 11:24:43
问题 I have been tasked with replacing a legacy java system with something which runs PHP. I am getting a little stuck on replacing the java cryptography with PHP code. cipherAlgorythm = "PBEWithMD5AndDES"; cipherTransformation = "PBEWithMD5AndDES/CBC/PKCS5Padding"; PBEParameterSpec ps = new javax.crypto.spec.PBEParameterSpec(salt, iterations); SecretKeyFactory kf = SecretKeyFactory.getInstance(cipherAlgorythm); SecretKey key = kf.generateSecret(new javax.crypto.spec.PBEKeySpec(password

Replacing JAVA with PHP for PKCS5 encryption

烈酒焚心 提交于 2021-02-06 11:24:24
问题 I have been tasked with replacing a legacy java system with something which runs PHP. I am getting a little stuck on replacing the java cryptography with PHP code. cipherAlgorythm = "PBEWithMD5AndDES"; cipherTransformation = "PBEWithMD5AndDES/CBC/PKCS5Padding"; PBEParameterSpec ps = new javax.crypto.spec.PBEParameterSpec(salt, iterations); SecretKeyFactory kf = SecretKeyFactory.getInstance(cipherAlgorythm); SecretKey key = kf.generateSecret(new javax.crypto.spec.PBEKeySpec(password

Python to C# AES CBC PKCS7

て烟熏妆下的殇ゞ 提交于 2021-02-06 11:11:03
问题 I'm trying to convert this C# code to Python (2.5, GAE). The problem is that the encrypted string from the python script is different each time the encryption (on the same string) is run. string Encrypt(string textToEncrypt, string passphrase) { RijndaelManaged rijndaelCipher = new RijndaelManaged(); rijndaelCipher.Mode = CipherMode.CBC; rijndaelCipher.Padding = PaddingMode.PKCS7; rijndaelCipher.KeySize = 128; rijndaelCipher.BlockSize = 128; byte[] pwdBytes = Encoding.UTF8.GetBytes(passphrase

Python to C# AES CBC PKCS7

久未见 提交于 2021-02-06 11:06:01
问题 I'm trying to convert this C# code to Python (2.5, GAE). The problem is that the encrypted string from the python script is different each time the encryption (on the same string) is run. string Encrypt(string textToEncrypt, string passphrase) { RijndaelManaged rijndaelCipher = new RijndaelManaged(); rijndaelCipher.Mode = CipherMode.CBC; rijndaelCipher.Padding = PaddingMode.PKCS7; rijndaelCipher.KeySize = 128; rijndaelCipher.BlockSize = 128; byte[] pwdBytes = Encoding.UTF8.GetBytes(passphrase

Python to C# AES CBC PKCS7

北战南征 提交于 2021-02-06 11:05:01
问题 I'm trying to convert this C# code to Python (2.5, GAE). The problem is that the encrypted string from the python script is different each time the encryption (on the same string) is run. string Encrypt(string textToEncrypt, string passphrase) { RijndaelManaged rijndaelCipher = new RijndaelManaged(); rijndaelCipher.Mode = CipherMode.CBC; rijndaelCipher.Padding = PaddingMode.PKCS7; rijndaelCipher.KeySize = 128; rijndaelCipher.BlockSize = 128; byte[] pwdBytes = Encoding.UTF8.GetBytes(passphrase

how to keep c++ variables in RAM securely?

随声附和 提交于 2021-02-06 10:15:34
问题 I'm working on a C++ application which is keeping some user secret keys in the RAM. This secret keys are highly sensitive & I must minimize risk of any kind of attack against them. I'm using a character array to store these keys, I've read some contents about storing variables in CPU registers or even CPU cache (i.e using C++ register keyword), but seems there is not a guaranteed way to force application to store some of it's variables outside of RAM (I mean in CPU registers or cache). Can

how to keep c++ variables in RAM securely?

≡放荡痞女 提交于 2021-02-06 10:12:33
问题 I'm working on a C++ application which is keeping some user secret keys in the RAM. This secret keys are highly sensitive & I must minimize risk of any kind of attack against them. I'm using a character array to store these keys, I've read some contents about storing variables in CPU registers or even CPU cache (i.e using C++ register keyword), but seems there is not a guaranteed way to force application to store some of it's variables outside of RAM (I mean in CPU registers or cache). Can