aes 相关问题

高级加密标准(AES)是一种加密分组密码算法。

在 Cpp 中解密 AES 加密字符串时出现错误

当我使用解密函数解密字符串时,我得到了一些冗余字符。实际上,这段代码是为了加密和解密原始字节而编写的。 这是我的代码。 Python AES 加密...

回答 1 投票 0

Android,AES算法用密钥和IV加解密?

我想将明文加密和解密为AES算法。我得到了密钥,iv 来自 API。我尝试了很多东西但没有成功。怎么了? https://github.com/simbiose/Encryption https://git...

回答 3 投票 0

尝试使用crypto在nodejs中解密使用AES 256(AES / ECB / PKCS7Padding)算法生成的加密密钥

我尝试使用 aes256、aes-cross 和 crypto。 但我无法解密使用 AES 256 (aes-256-ecb) 和 PKCS7 填充加密的密钥。 我最终遇到了以下提到的错误。

回答 2 投票 0

AES-256-CBC 加密在 Python 和 PHP 中返回不同的结果

Python代码: 导入哈希库 导入 json 导入base64 导入请求 从 Crypto.Cipher 导入 AES 阿道夫类: def __init__(自身): self.secret_key = "SSSSSSSSSSSS" ...

回答 1 投票 0

AES-128-CTR 解密在使用 crypto 和 Crypto-JS 模块时在节点中给出空字符串输出

我正在尝试使用 crypto-js javascript 库解密数据,并尝试使用节点加密库在 Nodejs 端加密相同的加密文本。我正在使用 AES 128 加密算法和 CTR mo...

回答 1 投票 0

C# AES:如何使用长度不是 128,192,256 位的密码加密数据?

我必须使用 AES 在 C# 中加密/解密数据。问题:密钥长度必须是128、192或256位。我希望用户可以输入长度为 6-256 个字符的任意密码。我读过...

回答 2 投票 0

如何在iPhone上解压AES加密的zip文件?

在我当前的 iPhone 项目中,我需要在 Mac 上使用 StuffIt Engine 或在 Windows 上使用 WinZip 解密使用 AES 256 方法加密的 zip 文件。 我尝试使用 ZipArchive(ba...

回答 4 投票 0

Java AES T 表实现

我正在尝试实现一个使用 AES T-Tables 实现的加密函数。 我非常确定我的 roundKeys 是正确的。 我还知道下面的初始回合密钥添加...

回答 1 投票 0

AES256 CBC 与 AES256 GCM 性能对比?

根据我的搜索,AES256 CBC 似乎比 AES256 GCM 慢。 然而今天我在 iPhone 13 Pro Max 模拟器上测试了这两种模式,它们让我感到困惑。 对于 AES256 CBC,我使用 ob...

回答 2 投票 0

无法使用 CryptoJS (Javascript) 复制加密 AES-CBC (Java)

目标:使用 CryptoJS (Javascript) 复制 Java-AES-CBC 加密/解密 为什么?:使用 CryptoJS 创建加密字符串(Base64 或 HEX)并使用 Java 进行解码(不同的服务器环境) 问题:我...

回答 1 投票 0

填充无效且无法删除 - 仅限服务器端

我是新手,AES 加密模块不是我制作的,所以我有点挣扎。 我可以分享的事情: 在我的本地机器上工作没有问题 密钥是硬编码在代码中的,所以它

回答 1 投票 0

Objective-C 中的 AES 字符串加密

我的 Objective-C 应用程序需要文本/字符串加密(特别是 nsstring)。 我知道 AES 是可供消费者使用的最安全的加密方法。我还了解如何将字符串转换为

回答 5 投票 0

flutter 中使用 AES 加密

fun getEncryption(密码:字符串):字符串{ val盐=“abcdefghijkl” Aes256.加密(密码,盐) } } 公开课 Aes256

回答 1 投票 0

如何使用密码和javascript函数解密AES-GCM加密文本?

异步函数generateAESKeyFromPassword(password) { const 编码器 = new TextEncoder(); const passwordKey =等待 crypto.subtle.importKey('raw',encoder.encode(password),'PBKDF2', false,['deriv...

回答 1 投票 0

C# 和 openssl 之间的 aes-128-cbc 不同

我正在尝试解密此数据,给定密钥和 IV,但 c# 和 openssl 之间的结果不同 Openssl操作: ### 客户端密钥 $ 十六进制键=f656d037b173ef3e11169f27231a84b6 ### IV为此

回答 1 投票 0

是否可以使用没有特殊字符的 AES 加密?

下午好,我目前正在使用JAVA和Quarkus中的api,在其中我通过GET方法接收url中使用AES加密的参数,问题是加密

回答 1 投票 0

无法正确加密文件上传流

我正在尝试加密和解密上传到运行 Express 的 Node.JS 服务器的文件。文件从 HTML 表单上传并发送到加密传入文件流的函数,

回答 1 投票 0

`openssl genrsa -aes-128-cbc -passout pass:qwerty0123456789 -out private.pem 2048`中CBC模式的关键是什么?

我不知道 cbc 模式下的密钥,我尝试编写脚本 python 并期望它返回 MIIE...但它不会 从base64导入b64解码,b64编码 从 Crypto.Cipher 导入 AES 数据=“

回答 1 投票 0

C 中的 Aes-128-cbc 加密和 openssl 中的解密

我编写了一个读取文件并使用 Aes-cbc-128 对其进行加密的代码 # 包括 //# 包括 # 包括 # 包括 # 包括 我编写了一个读取文件并使用 Aes-cbc-128 对其进行加密的代码 # include <stdio.h> //# include <ctype.h> # include <string.h> # include <stdio.h> # include <stdlib.h> # include <openssl/aes.h> # define BLOCK_LEN 16 # define MAXBUF 256 # define MAXHEX (MAXBUF * 2) + 1 # define KEY "0123456789abcdef" # define IV "RandomIVRandomIV" unsigned int bin2hex (unsigned char *in, unsigned char *out, unsigned int len); unsigned int hex2bin (unsigned char *in, unsigned char *out, unsigned int len); unsigned int PadData (unsigned char *ibuf, unsigned int ilen, int blksize); unsigned int NoPadLen (unsigned char *ibuf, unsigned int ilen); void print_hex(char *iv) {int i=0; for (i =0; i < 16; ++i) printf("%02x", iv[i]); printf("\n"); } void callkey (unsigned char *keyFileName) { unsigned char key[] = KEY; FILE *keyFile = fopen(keyFileName, "wb"); fwrite(key, 1, 16, keyFile); fclose(keyFile); printf("Key Hex : "); print_hex(key); } int main(int argc, char *argv[]) { unsigned long ilen; unsigned char data[MAXBUF]; // command line input unsigned char ibuf[MAXBUF + BLOCK_LEN]; // padded input to encrypt unsigned char obuf[MAXHEX]; // encrypt output unsigned char xbuf[MAXHEX]; // hex encrypt output unsigned char ybuf[MAXBUF]; // hex decrypt output unsigned char dbuf[MAXBUF]; // decrypt output unsigned char key[] = KEY; unsigned char iv[] = IV; AES_KEY aeskeyEnc, aeskeyDec; unsigned int len =0; FILE *inFile = fopen(argv[1], "rb"); FILE *outFile = fopen(argv[2], "wb"); unsigned char *k1ey = "static.key"; callkey(k1ey); while((len = fread(data, 1, sizeof(data), inFile)) > 0) { // prepare the input data with padding printf("len = %d \n", len); memset (ibuf, 0x00, MAXBUF); memcpy (ibuf, data, len); // pad and calc length of block to encode ilen = PadData (ibuf, len, BLOCK_LEN); printf("ilength = %ld \n", ilen); // init cipher keys AES_set_encrypt_key (key, 128, &aeskeyEnc); AES_set_decrypt_key (key, 128, &aeskeyDec); // encrypt string memcpy (iv,IV, sizeof (IV)); memset(obuf, 0x00, MAXHEX); AES_cbc_encrypt (ibuf, obuf, ilen, &aeskeyEnc, iv, AES_ENCRYPT); len = fwrite(obuf,1, ilen, outFile); printf("writtenLen: %d\n", len); memset(data, 0x00, MAXBUF); } // while (1) fclose(inFile); fclose(outFile); return (0); } /* * The PadData() function is used to pad input data for cipher block * chaining using standard padding as specified in PKCS#5. Input data * is padded in place. The ilen value is the length of the data before * padding. The blksize parameter is the block size to use (16 for AES CBC). * The function returns the new length of ibuf after padding. * * NOTE: The ibuf must be large enough to hold at least blksize additional * bytes of data to accommodate padding. */ unsigned int PadData (unsigned char *ibuf, unsigned int ilen, int blksize) { unsigned int i; // loop counter unsigned char pad; // pad character (calculated) unsigned char *p; // pointer to end of data //if(ilen % blksize == 0) // return ilen; // calculate pad character pad = (unsigned char) (blksize - (ilen % blksize)); // append pad to end of string p = ibuf + ilen; for (i = 0; i < (int) pad; i++) { *p = pad; ++p; } return (ilen + pad); } 在 openssl 中我解密了我编码的文件, gcc aescodefile -o aes -lcrypto -lssl -ldl #this is to to complile code ./aes filetobeencrypted.txt encryptedfile #execute file openssl enc -aes-128-cbc -d -in filetobeencrypted.txt -out aes-decrypted.c -p -nosalt -K 30313233343536373839616263646566 -iv 52616e646f6d495652616e646f6d4956 此代码在解密后会给出一些垃圾值。我无法增加缓冲区大小。 请建议可以采取什么措施来纠正这个问题。 问题在于 C 代码对每个 256 字节缓冲区执行填充。相反,它应该加密 without padding 256 字节块。然后它应该填充最后一个纯文本块并对其进行加密(即使它是完整块大小或 0 字节)。

回答 1 投票 0

数据损坏 AES C#

快速提醒,我知道这是重复的,但答案对我没有帮助。 所以我尝试建立 AES 和 RSA 加密连接,这样我就可以加密非常大的东西,但是在解密一些...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.