aes

AES encryption how to transport IV

江枫思渺然 提交于 2019-11-30 06:24:36
问题 I understand that unique IV is important in encrypting to prevent attacks like frequency analysis. The question: For AES CBC encryption, whats the importance of the IV? has a pretty clear answer explaining the importance of the IV. Would there be any security holes in sending the IV in clear text? Or would it need to be encrypted with the same public/private key that was used to send the symmetric key? If the IV needs to be sent encrypted, then why not generate a new symmetric key each time

incorrect decryption using AES/CBC/PKCS5Padding in Android

半世苍凉 提交于 2019-11-30 05:47:55
I wrote the following code in Android (v2.2 API 8), where a plain text is entered and the code encrypts it using a user password and a random salt and then decrypts it. After running the code I only get part of the plain text correct. For example the user enters "Msg 1.5 to encrypt" and the result from the decryption code is "Msg15toencrypg==" Here is the code: private EditText plain_msg; private EditText pwd; private TextView result; byte[] iv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); plain_msg = (EditText

Decryption of AES created with sjcl.js in ruby

旧城冷巷雨未停 提交于 2019-11-30 05:44:49
问题 Hi so lets assume that client-side has a key that is not transfered via the same channel as the encrypted data. What I am trying to accomplish is to decrypt the result of Stanford Javascript Crypto Library (sjcl) in ruby. or for a generalisation in any other language that has a crypto library that has support for AES. Here is what I am doing in javascript: sjcl.encrypt('stack-password', 'overflow-secret') And this is what I get in return: { "iv": "Tbn0mZxQcroWnq4g/Pm+Gg", "v": 1, "iter": 1000

How do i decrypt a file in Android with AES?

我的未来我决定 提交于 2019-11-30 05:33:05
I have a file (mp3) that i Encrypt, my intention is then to download this file to an android device and decrypt it, but during decryption i get an IOException: java.io.IOException: last block incomplete in decryption I am aware of the obvious security flaws in the following code, I'm just trying to get it to work first. Any help on this is appreciated and I am quite a newcomer to coding in general so excuse me in advance if this is a stupid question! Encryption class(Not done in Android, works): public class EncryptFile { public static void main(String args[]) { if (args.length < 1) { System

AES/CBC/PKCS5PADDING IV - Decryption in NodeJs (Encrypted in Java)

南笙酒味 提交于 2019-11-30 05:25:50
I am trying to decrypt in NodeJs. It is working in Java. But I am not able to achieve same in Node. node-version: 8.4 Please find my NodeJs code: var crypto = require('crypto'); function decryption (message, key) { var messageArray = Buffer.from(message, 'base64'); // var kekbuf = Buffer(key, 'utf8'); var ivBuffer = new Buffer([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); var iv = ivBuffer.slice(0, 16); var decipher = crypto.createDecipheriv('aes-256-cbc', key, iv); decipher.setAutoPadding(false); var dec = decipher.update(messageArray, 'base64'); dec += decipher.final(); return dec.toString(); } Please

javax.crypto.IllegalBlockSizeException: last block incomplete in decryption - Decrypting an encrypted AES String

北慕城南 提交于 2019-11-30 05:16:24
I am trying to decrypt the string "~9?8?m???=?T?G" that I receive from a back-end server which uses OpenSSL to encrypt the String using AES-256-CBC. There is the code block: public static String decryptText(String textToDecrypt) { try { byte[] base64TextToDecrypt = Base64.encodeBase64(textToDecrypt.getBytes("UTF-8")); byte[] guid = "fjakdsjkld;asfj".getBytes("UTF-8"); byte[] iv = new byte[16]; System.arraycopy(guid, 0, iv, 0, guid.length); IvParameterSpec ips = new IvParameterSpec(iv); byte[] secret = DECRYPTION_SECRET_HASH.getBytes("UTF-8"); SecretKeySpec secretKey = new SecretKeySpec(secret,

Why is the ciphertext 32 bytes long when encrypting 16 bytes with AES?

强颜欢笑 提交于 2019-11-30 05:06:41
I use encryption AES algorithm, when i encrypt 16 byte(one block) the result is 32 byte. Is this ok? My source code that i used is: package net.sf.andhsli.hotspotlogin; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; /** * Usage: * <pre> * String crypto = SimpleCrypto.encrypt(masterpassword, cleartext) * ... * String cleartext = SimpleCrypto.decrypt(masterpassword, crypto) * </pre> * @author ferenc.hechler */ public class SimpleCrypto { public static String encrypt(String

EnvelopedCMS with AES and rsaEncryption (PKCS#1 v1.5 padding instead of v2 (OAEP) padding) possible?

廉价感情. 提交于 2019-11-30 04:49:35
问题 I've been using .NET for cryptographic purposes a bit. Up to now, I used 3DES (Oid 1.2.840.113549.3.7) in combination with rsaEncryption (Oid 1.2.840.113549.1.1.1, RSAES-PKCS1-v1_5). While the first one has now to be replaced by AES (Oid 2.16.840.1.101.3.4.1.42), I still have to use rsaEncryption / RSAES-PKCS1-v1_5 , not RSAES-OAEP . If I just pass an additional argument to the EnvelopedCMS constructor that I'm calling, I can switch from 3DES to AES: ContentInfo plainContent = new ContentInfo

How to decompress an AES-256 encrypted Zip file?

给你一囗甜甜゛ 提交于 2019-11-30 04:07:47
I am looking for a compression library to use in iPhone application supports decompressing AES 256-bit archives built in Winzip compression utility. Thanks. zlib is part of the iPhone sdk and is a well established and free option. If you're using Xcode you can add it to your project by: Right clicking on the Frameworks folder in your project (you can do it elsewhere but that's likely where you want to put it) Select add file Select existing frameworks Select libz.1.2.3.dylib Thank you very much for the help I finally ened up using ZipArchive library from: http://www.artpol-software.com I had

How does Mega's encryption work for sharing?

a 夏天 提交于 2019-11-30 04:03:21
I have some issues regarding to find a way to achieve the encryption of arbitrary data that can be shared with multiple recipients. Mega seems to do exactly that. As far as I read it encrypts the data before its uploaded to the web server. Still it is possible to share that file with others. How is that done with the encryption? Imagine the following scenario: User Alice uploads a file to the server, it is being encrypted Alice wants to share that file with Bob and Dave. How can Bob and Dave access the file and see its original content (decrypted)? How is that done with the encryption? The