encryption-symmetric

Android decryption: Error while finalizing cipher

落爺英雄遲暮 提交于 2019-12-03 20:59:38
I am using Android to encrypt and encrypt images sent between apps. The encryption works well but when the file arrives at the destination it will not decrypt. Now I have copied the file at the destination app and decrypted it successfully using 3rd-party software. The error I get is:"Error while finalizing cipher" at CipherInputStream (CipherInputStream.java:107) caused by IllegalBlockSizeException. The encryption & decryption code is below: public static String encrypt(String plainFile, String encryptedFile) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException,

Should one use Cryptographic message syntax (CMS) for this task?

孤者浪人 提交于 2019-12-03 20:21:32
I've the task to transfer small binary messages (1 or 2 kb long) between a desktop application and mobile devices. The messages should be encrypted asymmetrically (RSA for instance). From what I've learned one should use a hybrid cryptosystem for this kind of task: Generate random symmetric key Encrypt plain text with symmetric key (using AES for instance) Encrypt symmetric key with public key Transmit cipher text and encrypted symmetric key I'd like to not invent an own format for storing the cipher text and the encrypted symmetric key. So I stumbled over CMS standard (Cryptographic message

What is the performance difference of pki to symmetric encryption?

巧了我就是萌 提交于 2019-12-03 16:59:46
问题 We are looking to do some heavy security requirements on our project, and we need to do a lot of encryption that is highly performant. I think that I know that PKI is much slower and more complex than symmetric encryption, but I can't find the numbers to back up my feelings. 回答1: Yes, purely asymmetric encryption is much slower than symmetric cyphers (like DES or AES), which is why real applications use hybrid cryptography: the expensive public-key operations are performed only to encrypt

Stopping decryption before EOF throws exception: Padding is invalid and cannot be removed

自作多情 提交于 2019-12-03 12:19:46
This is the scenario we have: We have huge encrypted files, in the order of gigabytes that we can decrypt correctly if we read them until the end. The problem arises when we are reading and detect some flag in the file, then we stop reading and call reader.Close(), what happens is that a CryptographicException: "Padding is invalid and cannot be removed." is thrown. I have this small console app that reproduce this behavior, to test it just run it, it will create a file in your C:\ drive and then it will read line by line when pressing any key, and will stop when pressing 'q'. using System;

Which symmetric key algorithm does SSL use?

旧城冷巷雨未停 提交于 2019-12-03 09:03:19
问题 I understand that through SSL, the browser gets the public key of the secured website and through public key encryption rsa algorithm, these 2 establish session key and then continue communication thru some symmetric algorithm, because symmetric key encryption/decryption is faster. Which symmetric key algorithm does SSL use? DES? AES? or something else? 回答1: When the client connects to the server, it negotiates a so-called ciphersuite (combination of encryption, key exchange, authentication

Questions about the NaCL crypto library

送分小仙女□ 提交于 2019-12-03 07:48:38
问题 I was looking for libraries to implement an encryption system and was interested in using the NaCl: Networking and Cryptography library specifically the box function. Obviously, it uses symmetric encryption XSalsa20, Curve25519 for public-private cryptography and Poly1305 for authentication as the primitives for it. However, the documentation looks to be insufficient in the way the they've been used. For example, it mentions that to compute the key it uses the sender's private key and the

Using Rijndael encryption for large files

守給你的承諾、 提交于 2019-12-03 07:23:34
I'm in a situation where I need to encrypt / decrypt a file of n length securely, ideally using Rijndael, but definitely at 256bit encryption. I've played around with encryption before and have encrypted/decrypted strings and byte arrays quite happily. However, because I don't know the size of the file (and it's very feasible that the files in question could be quite large (~2.5gb) I can't just load them up into a byte array and enc/decrypt them in a single bound as I have before. So, after a bit of reading around on Google, I knew the answer was to encrypt and decrypt the file in chunks, and

Where to Store Encryption Keys MVC Application

拈花ヽ惹草 提交于 2019-12-03 06:50:34
I am using a AES encryption/decryption class that needs a key value and vector value encrypt and decrypt data in an MVC3 application. On saving the record I am encrypting the data then storing in a database. When i retrieve the record i am decrypting in the controller and passing the unencrypted value to the view. The concern is not protecting data as it traverses the network but to protect the database should it be compromised. I have read many posts that say dont put the keys for encryption in your code. Ok so where should they be kept? File system? Another Database? Looking for some

PHP equivalent of .net AES encryption

梦想的初衷 提交于 2019-12-02 23:39:11
问题 I am working on a data exchange integration with my client and the data they send me is encrypted using their C# encrypt method (below). My app is running PHP 5.3 and I need an equivalent code to decrypt the data they send. I have the PHP code but it'd not decrypt the client data correctly for me. Clearly I am making some mistake in my encryption/decryption methods, IV key or something. Can anyone spot the mistake? Thanks. C# Code (From my client): using System; using System.Security

Which symmetric key algorithm does SSL use?

大城市里の小女人 提交于 2019-12-02 23:21:43
I understand that through SSL, the browser gets the public key of the secured website and through public key encryption rsa algorithm, these 2 establish session key and then continue communication thru some symmetric algorithm, because symmetric key encryption/decryption is faster. Which symmetric key algorithm does SSL use? DES? AES? or something else? When the client connects to the server, it negotiates a so-called ciphersuite (combination of encryption, key exchange, authentication algorithms) to use. Each SSL client or server has a list of allowed ciphersuites and during handshake the