aes

Correct Parameters to pass to Encrypt AES in Coldfusion 8 (or 10)

时光总嘲笑我的痴心妄想 提交于 2020-01-15 06:11:31
问题 So I have (this doesn’t work b/c hex is probably wrong and the key and the IV are not converted correctly): (aesKey and aesIV are provided as hex strings from Third Party) They look something like this (not the same but should be enough to work with I replaced some values in the keys so they aren’t exactly the same: <cfparam name="aesKey" default="C20648780E8843795325F3BA5EC43183C8BFA2D26B5470BC309ED5BA6B142EFA"/> <cfparam name="aesIV" default="A53F0A6E6972A0095CFFDBE4F47C3CF8"/> <cfset token

PKCS#5 padding for AES encryption in C/C++

被刻印的时光 ゝ 提交于 2020-01-15 05:30:11
问题 I did AES/ECB/PKCS5Padding encryption in JAVA . Now I am looking for equivalent method in C/C++ . I did manage to encrypt in C using the following code : const unsigned char *key = (unsigned char *)"A2XTXFEQFOPZFAKXFOPZFAK5"; unsigned char input[] = {"Hello World"}; int iLen = strlen((char*)input); int len = 0; if(iLen % 16 == 0){ len = iLen; } else{ len = (iLen/16)*16 + 16; } unsigned char output[len]; //next 16bit AES_KEY enc_key; AES_set_encrypt_key(key, strlen((char*)key)*8, &enc_key);

AES加密传输密文密码

我只是一个虾纸丫 提交于 2020-01-14 19:41:16
1.高级加密标准(AES,Advanced Encryption Standard)为最常见的对称加密算法。对称加密算法也就是加密和解密用相同的密钥。 package cn.com.test; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; import sun.misc.BASE64Decoder; public class AES { private static final String KEY = "a1b2c3d4e5f6g7h8"; private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding"; public static void main(String[] args) throws Exception { String content = "123456"; String s = aesEncrypt(content, KEY); System.out.println("sagfasdgfasd" + s); String decrypt =

AES encryption with plain text key using bash openssl

你说的曾经没有我的故事 提交于 2020-01-14 06:00:23
问题 I am trying to encrypt a string using AES CBC. The output of the online tool (http://aes.online-domain-tools.com/) and the bash openssl command do not match. Can anyone help me with what I am doing wrong? key = 12345678912345678912345678912345 iv="e90e89a2277f4f3b6a2080d27f734266" #using the one generated by online tool openssl enc -aes-256-cbc -in input.txt -out output.txt -K $key -iv $iv EDIT - more info on the settings chosen on the site - Input type - plain text Function - AES Mode - CBC

AES_ctr128_encrypt string and vice versa ANSI C

落花浮王杯 提交于 2020-01-14 05:44:26
问题 I need to insert a 128 hex key to cipher by blocks (16) a string content, and then I want to decrypyt that string(crypted) to a plain text. Sometimes I have the same output, but not totaly correct! I am doing this right?! My code now: #include <openssl/aes.h> #include <openssl/rand.h> #include <openssl/hmac.h> #include <openssl/buffer.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> // Code example uses partail code from: http://stackoverflow.com/questions

Unable to replicate an encryption format from Java to PHP

丶灬走出姿态 提交于 2020-01-14 04:44:27
问题 I have the following Java code which was shared by one of an integration partner for their API encryption import java.nio.ByteBuffer; import java.security.AlgorithmParameters; import java.security.SecureRandom; import java.security.spec.KeySpec; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec

Storing the IV with the ciphertext Crypto++ CBC AES encryption

匆匆过客 提交于 2020-01-14 04:38:05
问题 I'm trying to encrypt(and decrypt after) a file using AES in CBC mode and Crypto++ library Here's what I already did: using namespace CryptoPP; AutoSeededRandomPool rnd; //generating the key and iv SecByteBlock key(AES::MAX_KEYLENGTH); rnd.GenerateBlock(key, key.size()); byte iv[AES::BLOCKSIZE]; rnd.GenerateBlock(iv, AES::BLOCKSIZE); To encrypt a file,I open it in binary mode,and dump the content to a string : std::ifstream fin(file_path, std::ios::binary); if (!fin) { std::cout << "error"; }

python AES 加密

谁说胖子不能爱 提交于 2020-01-14 04:21:41
pad: ZeroPadding mode: cbc #!/usr/bin/env python # -*- coding:utf-8 -*- # 这里使用pycrypto‎库 # 按照方法:easy_install pycrypto‎ from Crypto.Cipher import AES import base64 class prpcrypt(): def __init__(self, key, iv): self.key = key self.mode = AES.MODE_CBC self.iv = iv # 加密函数,如果text不足16位就用空格补足为16位, # 如果大于16当时不是16的倍数,那就补足为16的倍数。 def encrypt(self, text): cryptor = AES.new('123454536f667445454d537973576562', self.mode, IV=self.iv) # 这里密钥key 长度必须为16(AES-128), # 24(AES-192),或者32 (AES-256)Bytes 长度 # 目前AES-128 足够目前使用 length = 16 count = len(text) if count < length: add = (length - count) #\0 backspace text

iPhone: Encrypt Nsstring using AES 128 and Decrypt

浪子不回头ぞ 提交于 2020-01-14 03:10:13
问题 I am new to Encryption/ Decryption. I want to encrypt a NSString variable value using key. Also I want to decrypt the encrypted data . I want to apply AES -128 Algorithm. Please suggest sample code or useful link. 回答1: I found this through a Google search on the terms aes nsstring site:stackoverflow.com : AES Encryption for an NSString on the iPhone 来源: https://stackoverflow.com/questions/2808568/iphone-encrypt-nsstring-using-aes-128-and-decrypt