aes

Size of data after AES decryption

女生的网名这么多〃 提交于 2019-12-12 03:18:35
问题 I only found this question answered: Size of data after AES/CBC and AES/ECB encryption Since AES adds padding to the end of an encrypted message, there is a simple formula to determine the expected output length, given the input length. However, is there any way to determine what is the expected size of the DECRYPTED message? And if there isn't, should I just send it along with the iv and the encrypted message? 回答1: AES is a block cipher. Block ciphers only encrypt blocks, in case of AES,

Split hex value into individual components

喜欢而已 提交于 2019-12-12 03:05:47
问题 How do I split a hex value into individual values. Suppose I have a byte, 0xFF. How would I get one value being F and a second being F in Objective-C? I'm trying to implement the SubBytes() procedure in Objective-C and obviously, the SubBytes() step involves a matrix where the output is dependent on the first and second hex representations of the byte. 回答1: Here's an example of how you can mask out / shift the portion of the hex bytes that you're looking for: Byte exampleValue = 0x23; Byte

AES decrypt in php

别说谁变了你拦得住时间么 提交于 2019-12-12 02:54:20
问题 I am new to AES but from what I have found there are several modes (ECB,CBC, etc.) and different modes need different initialization vector requirements, blocks, and encodings. I am trying to decode the following Xrb9YtT7cHUdpHYIvEWeJIAbkxWUtCNcjdzOMgyxJzU/vW9xHivdEDFKeszC93B6MMkhctR35e+YkmYI5ejMf5ofNxaiQcZbf3OBBsngfWUZxfvnrE2u1lD5+R6cn88vk4+mwEs3WoAht1CAkjr7P+fRIaCTckWLaF9ZAgo1/rvYA8EGDc+uXgWv9KvYpDDsCd1JStrD96IACN3DNuO28lVOsKrhcEWhDjAx+yh72wM= using php and the (text) key

Java code to decrypt the node.js encrypted string

我的未来我决定 提交于 2019-12-12 02:47:22
问题 I have a server which encrypts the some data using var key = new Buffer('Kay8u5Dev5al7', 'utf-8'); var encrypt = function(key, data) { var cipher = crypto.createCipher('aes256', key); var crypted = cipher.update(data, 'utf-8', 'hex'); crypted += cipher.final('hex'); return crypted; } Now I want to decrypt the data back using a java client. Though I referred some examples to decrypt in java I could'nt get the data back. I am using JCE security jars at the client side. 来源: https://stackoverflow

AES Cpu Consumption: What's cheaper? To encrypt/decrypt 1024 bytes in AES-256 or 512 in AES-128 and 512 in AES-256

耗尽温柔 提交于 2019-12-12 02:39:44
问题 I am trying to figure out if it is worth using differential privacy on some data that I need to secure. So what is less CPU intensive? Encrypt the whole data in AES-256 or encrypt parts of it in AES-256 and other parts in AES-128. Is the difference significant? Mixing schemes will require the generation of more keys and ivs for each different level of encryption. Any references? Comments? 回答1: Encrypt everything with AES-128 if you care about performance. AES-256 is not much more secure in

java - Aes 加密-解密

无人久伴 提交于 2019-12-12 02:32:29
package com . jscz . common . utils ; import org . apache . commons . codec . binary . Base64 ; import javax . crypto . Cipher ; import javax . crypto . KeyGenerator ; import javax . crypto . spec . SecretKeySpec ; public class AesEncryptUtils { //可配置到Constant中,并读取配置文件注入 private static final String KEY = "abcdef0123456789" ; //参数分别代表 算法名称/加密模式/数据填充方式 private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding" ; /** * 加密 * @param content 加密的字符串 * @param encryptKey key值 * @return * @throws Exception */ public static String encrypt ( String content , String encryptKey ) throws Exception {

Converting Ruby AES256 decrypt function to PHP

烈酒焚心 提交于 2019-12-12 02:08:20
问题 I have the following function in Ruby that decrypts a bit of data: def decrypt(key, iv, cipher_hex) cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') cipher.decrypt cipher.key = key.gsub(/(..)/){|h| h.hex.chr} cipher.iv = iv.gsub(/(..)/){|h| h.hex.chr} decrypted_data = cipher.update(cipher_hex.gsub(/(..)/){|h| h.hex.chr}) decrypted_data << cipher.final return decrypted_data end I'm trying to do the exact same thing in PHP, but I'm not sure what I'm doing wrong. Here's what I've got:

CryptoStream does not decrypt properly

空扰寡人 提交于 2019-12-12 01:42:32
问题 I have a working TCP-connection between a server application and a client, wich communicate encrypted with AES. it works with an CryptoStream having an RijndaelManaged En/Decrypter. well Right now, if i want to send sth. like this: "F4FBF-B60FC-6F3ED-1E5A9" i get that as output : "Ü]Þí£ôÉò×â×$¼ÚD-1E5A9" so... what could be going wrong here? why is that still encryptet up to "D-1E5A9"? Well here some Code: Server: while (true) { Console.Write("Waiting for a connection... "); TcpClient client =

C# AES - Padding is Invalid and cannot be removed [closed]

廉价感情. 提交于 2019-12-12 01:38:41
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have been struggling with this problem for several days now. I have read all the posts out there about this padding issue - which can often be caused by an incorrect key (possibly the case here - but I'm not seeing it. Code Below: internal class AESEncryptionManager { private byte[] keyBytes { get; set; }

Objective-C library recommendation for AES-256 in CTR mode

◇◆丶佛笑我妖孽 提交于 2019-12-12 01:18:29
问题 I'm looking for recommendations on an Objective-C library for AES-256 encryption in CTR mode. I have a database full of data encrypted with another library using CTR and seems the included CCCrypt only supports ECB or CBC with PKCS#7. Any idea on the best portable library I should use? I'm not looking to port the original implementation as I don't have the required knowledge in cryptography and hence, that's-a-bad-idea (tm). Thanks! 回答1: You should be able to implement this using OpenSSL. It