这篇教程C++ AES_set_decrypt_key函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AES_set_decrypt_key函数的典型用法代码示例。如果您正苦于以下问题:C++ AES_set_decrypt_key函数的具体用法?C++ AES_set_decrypt_key怎么用?C++ AES_set_decrypt_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AES_set_decrypt_key函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CryptState_genKeyvoid CryptState_genKey(cryptState_t *cs) { RAND_bytes(cs->raw_key, AES_BLOCK_SIZE); RAND_bytes(cs->encrypt_iv, AES_BLOCK_SIZE); RAND_bytes(cs->decrypt_iv, AES_BLOCK_SIZE);#ifndef USE_POLARSSL AES_set_encrypt_key(cs->raw_key, 128, &cs->encrypt_key); AES_set_decrypt_key(cs->raw_key, 128, &cs->decrypt_key);#else aes_setkey_enc(&cs->aes_enc, cs->raw_key, 128); aes_setkey_dec(&cs->aes_dec, cs->raw_key, 128);#endif cs->bInit = true;}
开发者ID:cyberroadie,项目名称:umurmur,代码行数:13,
示例2: memsetvoid Message::dechiffrement(const unsigned char *key){ unsigned char trame [1024]; const char *chif = this->chiffre.toStdString().c_str(); unsigned char iv[AES_BLOCK_SIZE]; memset(iv, 0x00, AES_BLOCK_SIZE); AES_KEY dec_key; AES_set_decrypt_key(key,256,&dec_key); AES_cbc_encrypt((const unsigned char *)chif,trame,strlen(chif),&dec_key, iv,AES_DECRYPT); this->msg = QString((const char *)trame);}
开发者ID:Ektoplasma,项目名称:frontale,代码行数:13,
示例3: mainmain(){ AES_set_encrypt_key(test_key, 128, &encks); AES_set_decrypt_key(test_key, 128, &decks); test_vector(vector_17, sizeof(vector_17)); test_vector(vector_31, sizeof(vector_31)); test_vector(vector_32, sizeof(vector_32)); test_vector(vector_47, sizeof(vector_47)); test_vector(vector_48, sizeof(vector_48)); test_vector(vector_64, sizeof(vector_64)); exit(0);}
开发者ID:slave5vw,项目名称:IEEE_Taggant_System,代码行数:13,
示例4: aes_decrypte/* * des - aes加密函数 * param - ciphertext: 密文数据 * plaintext: 解密后明文数据 * len: 密文数据长度,CBC模式以bytes为单位进行加密,该len长度有一定容错空间,解密不会出错。建议传入密文数据长度。 * * ret - void */void aes_decrypte(const u_char *ciphertext, u_char *plaintext, u_int len){ AES_KEY key; unsigned char inner_iv[AES_BLOCK_SIZE * 4]; int nr_of_bits = 0; memcpy(inner_iv, iv, sizeof(iv)); nr_of_bits = 8 * sizeof(rkey); AES_set_decrypt_key(rkey, nr_of_bits, &key); AES_cbc_encrypt(ciphertext, plaintext, len, &key, inner_iv, AES_DECRYPT); }
开发者ID:misslio,项目名称:lctools,代码行数:21,
示例5: aes_set_decrypt_keystatic int aes_set_decrypt_key(struct ssh_cipher_struct *cipher, void *key, void *IV) { if (cipher->key == NULL) { if (alloc_key(cipher) < 0) { return -1; } if (AES_set_decrypt_key(key,cipher->keysize,cipher->key) < 0) { SAFE_FREE(cipher->key); return -1; } } cipher->IV=IV; return 0;}
开发者ID:SHLD,项目名称:node-libssh,代码行数:14,
示例6: encrypt_datavoid encrypt_data(FILE* input_file, FILE* output_file){ unsigned char inbuf[80]; unsigned char outbuf[80]; unsigned char decbuf[80]; int inlen, outlen; AES_KEY enc_key; AES_KEY dec_key; AES_set_encrypt_key(key, 128, &enc_key); //while(1) { int i; inlen = 80; outlen = 80;// inlen = fread(inbuf, 1, 80, input_file); for (i=0; i<inlen; i++) { inbuf[i]=0; } printf("input data is /n"); for (i = 0; i < inlen; i++) { printf("%c ", inbuf[i]); } printf("/n"); AES_encrypt(inbuf, outbuf, &enc_key); printf("encrypted data is /n"); for (i = 0; i < inlen; i++) { printf("%X ", outbuf[i]); } printf("/n"); AES_set_decrypt_key(key, 128, &dec_key); AES_decrypt(outbuf, decbuf, &dec_key); printf("decrypted data is /n"); for (i = 0; i < inlen; i++) { printf("%c ", decbuf[i]); } printf("/n"); outlen = fwrite(outbuf, 1, inlen, output_file);// if (outlen < AES_BLOCK_SIZE)// {// break;// } //}}
开发者ID:jagleeso,项目名称:jiawen-opencl,代码行数:50,
示例7: CryptState_setKeyvoid CryptState_setKey(cryptState_t *cs, const unsigned char *rkey, const unsigned char *eiv, const unsigned char *div){ memcpy(cs->raw_key, rkey, AES_BLOCK_SIZE); memcpy(cs->encrypt_iv, eiv, AES_BLOCK_SIZE); memcpy(cs->decrypt_iv, div, AES_BLOCK_SIZE);#ifndef USE_POLARSSL AES_set_encrypt_key(cs->decrypt_iv, 128, &cs->encrypt_key); AES_set_decrypt_key(cs->raw_key, 128, &cs->decrypt_key);#else aes_setkey_enc(&cs->aes_enc, cs->decrypt_iv, 128); aes_setkey_dec(&cs->aes_dec, cs->raw_key, 128);#endif cs->bInit = true;}
开发者ID:cyberroadie,项目名称:umurmur,代码行数:14,
示例8: aes256_initstatic void aes256_init(ops_crypt_t *crypt) { if (crypt->encrypt_key) free(crypt->encrypt_key); crypt->encrypt_key=malloc(sizeof(AES_KEY)); if (AES_set_encrypt_key(crypt->key,KEYBITS_AES256,crypt->encrypt_key)) fprintf(stderr,"aes256_init: Error setting encrypt_key/n"); if (crypt->decrypt_key) free(crypt->decrypt_key); crypt->decrypt_key=malloc(sizeof(AES_KEY)); if (AES_set_decrypt_key(crypt->key,KEYBITS_AES256,crypt->decrypt_key)) fprintf(stderr,"aes256_init: Error setting decrypt_key/n"); }
开发者ID:MrKID,项目名称:RetroShare,代码行数:14,
示例9: aesBlockDecryptguint8* aesBlockDecrypt(gchar *aesKey, gchar *aesIV, gchar *src, gint length) { AES_KEY key; AES_set_decrypt_key((const unsigned char *)aesKey, 128, &key); guint8 iv[16]; memcpy(iv, aesIV, sizeof(iv)); gint aeslen = length & ~0xf; guint8 *data = g_malloc(2048 * sizeof(guint8)); AES_cbc_encrypt((const unsigned char *)src, data, aeslen, &key, iv, AES_DECRYPT); memcpy(data + aeslen, src + aeslen, length - aeslen); return data;}
开发者ID:houzhenggang,项目名称:openwrt-ar9331,代码行数:14,
示例10: switchvoid svCrypto::SetAESKey(svAESCrypt mode, const uint8_t *plain_key, AES_KEY &crypt_key){ switch (mode) { case svAES_ENCRYPT: if (AES_set_encrypt_key(plain_key, aes_key_bits, &crypt_key) != 0) throw svExCryptoSetAESEncryptKey(); break; case svAES_DECRYPT: if (AES_set_decrypt_key(plain_key, aes_key_bits, &crypt_key) != 0) throw svExCryptoSetAESDecryptKey(); break; }}
开发者ID:adzymaniac,项目名称:dingap,代码行数:15,
示例11: AES256_ige_decryptvector<unsigned char> AES256_ige_decrypt(vector<unsigned char> encrypted_answer,vector<unsigned char> tmp_aes_iv,vector<unsigned char> tmp_aes_key){ vector<unsigned char> res(encrypted_answer.size(),0); AES_KEY key;// vector<unsigned char> x_0(tmp_aes_iv.begin(), tmp_aes_iv.begin()+10); // vector<unsigned char> y_0(tmp_aes_iv.begin()+10, tmp_aes_iv.end()); // tmp_aes_iv = mergeVectors(y_0, x_0); AES_set_decrypt_key(&tmp_aes_key[0], 256, &key); AES_ige_encrypt(&encrypted_answer[0], &res[0], encrypted_answer.size(), &key, &tmp_aes_iv[0], AES_DECRYPT); return res;}
开发者ID:fedochet,项目名称:SCLIC,代码行数:15,
示例12: decpryint decpry(char *ibuf, int len){ struct sys_key *pskey = get_shm(); struct sys_key skey; memcpy(&skey, pskey, sizeof(struct sys_key)); AES_KEY dec_key; unsigned char dec_out[len]; memset(dec_out, 0, len); AES_set_decrypt_key(skey.key, KEYLEN*8, &dec_key); AES_cbc_encrypt(ibuf, dec_out, len, &dec_key, skey.iv_dec, AES_DECRYPT); memcpy(ibuf, dec_out, len); return 0;}
开发者ID:zh-cool,项目名称:restful,代码行数:16,
示例13: aesBlock/* Encrypt or decrypt one block with AES and the given key */static void aesBlock(unsigned char out[16], const unsigned char key[], int keyBits, const unsigned char in[16], int dir){ extern void exit(int status); int retCode; AES_KEY aesKey; if (dir==AES_ENCRYPT) retCode = AES_set_encrypt_key(key, keyBits, &aesKey); else retCode = AES_set_decrypt_key(key, keyBits, &aesKey); if (retCode!=0) exit(retCode); /* Not very gracefull, but still... */ if (dir==AES_ENCRYPT) AES_encrypt(in, out, &aesKey); else AES_decrypt(in, out, &aesKey);}
开发者ID:rfjakob,项目名称:crypto1619,代码行数:17,
示例14: AES_KW_Decryptbool AES_KW_Decrypt(COSE_Enveloped * pcose, const byte * pbKeyIn, size_t cbitKey, const byte * pbCipherText, size_t cbCipherText, byte * pbKeyOut, int * pcbKeyOut, cose_errback * perr){ byte rgbOut[256 / 8]; AES_KEY key; CHECK_CONDITION(AES_set_decrypt_key(pbKeyIn, (int)cbitKey, &key) == 0, COSE_ERR_CRYPTO_FAIL); CHECK_CONDITION(AES_unwrap_key(&key, NULL, rgbOut, pbCipherText, (int) cbCipherText), COSE_ERR_CRYPTO_FAIL); memcpy(pbKeyOut, rgbOut, cbCipherText - 8); *pcbKeyOut = (int) (cbCipherText - 8); return true;errorReturn: return false;}
开发者ID:KaneRoot,项目名称:COSE-C,代码行数:16,
示例15: mainmain(){ AES_KEY AESkey; unsigned char MBlock[16]; unsigned char MBlock2[16]; unsigned char CBlock[16]; unsigned char Key[16]; int i; /* * Key contains the actual 128-bit AES key. AESkey is a data structure * holding a transformed version of the key, for efficiency. */ Key[0]=1; for (i=1; i<=15; i++) { Key[i] = 0; } AES_set_encrypt_key((const unsigned char *) Key, 128, &AESkey); MBlock[0] = 1; for (i=1; i<16; i++) MBlock[i] = 0; AES_encrypt((const unsigned char *) MBlock, CBlock, (const AES_KEY *) &AESkey); for (i=0; i<16; i++) printf("%X", CBlock[i]/16), printf("%X", CBlock[i]%16); printf("/n"); /* * We need to set AESkey appropriately before inverting AES. * Note that the underlying key Key is the same; just the data structure * AESkey is changing (for reasons of efficiency). */ AES_set_decrypt_key((const unsigned char *) Key, 128, &AESkey); AES_decrypt((const unsigned char *) CBlock, MBlock2, (const AES_KEY *) &AESkey); for (i=0; i<16; i++) printf("%X", MBlock2[i]/16), printf("%X", MBlock2[i]%16); printf("/n");}
开发者ID:torrencio,项目名称:elec490,代码行数:45,
示例16: aes_ecb_decryptstatic ERL_NIF_TERM aes_ecb_decrypt(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]){ ErlNifBinary in, out, key; // key must be binary if(!enif_inspect_binary(env, argv[0], &key)) { return enif_make_badarg(env); } // key size should be 16 byte if(key.size != 16) { return enif_make_badarg(env); } // cipher must be binary if(!enif_inspect_binary(env, argv[1], &in)) { return enif_make_badarg(env); } // cipher shoule be 16 byte block if(in.size % 16) { return enif_make_badarg(env); } unsigned char* decoded = (unsigned char*)malloc(sizeof(unsigned char)*in.size); struct aes_key_st* decrypt_key = (struct aes_key_st*)malloc(sizeof(AES_KEY)); memset(decrypt_key, 0, sizeof(AES_KEY)); AES_set_decrypt_key((unsigned char*)(key.data), 128, decrypt_key); int i = 0; for(i = 0; i < in.size; i += 16) { AES_decrypt((unsigned char*)&in.data[i], (unsigned char*)&decoded[i], decrypt_key); } //Remove padding unsigned char padding = (unsigned char) decoded[in.size-1]; if(!enif_alloc_binary(in.size - padding, &out)) { free(decoded); free(decrypt_key); return enif_make_badarg(env); } strncpy((unsigned char*)out.data, decoded, in.size - padding); free(decoded); free(decrypt_key); return enif_make_binary(env, &out);}
开发者ID:Asif-Malik1,项目名称:soul,代码行数:45,
示例17: AES_Crypto/* aes crypto function wrapper - p_text : plain text, c_text : cipher text, aes_key : from GetKey, mode : ENCRYPT/DECRYPT, size : data size */unsigned char* AES_Crypto(unsigned char* p_text, unsigned char* c_text, char* aes_key, unsigned char* iv, int mode, unsigned long size){ AES_KEY e_key, d_key; AES_set_encrypt_key((unsigned char*)aes_key, 128, &e_key); AES_set_decrypt_key((unsigned char*)aes_key, 128, &d_key); if(mode == 1) { AES_cbc_encrypt(p_text, c_text, size, &e_key, iv, AES_ENCRYPT); return c_text; } else { AES_cbc_encrypt(c_text, p_text, size, &d_key, iv, AES_DECRYPT); return p_text; }}
开发者ID:tizenorg,项目名称:framework.security.secure-storage,代码行数:19,
示例18: aes_block_decryptstatic bool aes_block_decrypt(void * buffer, size_t len){ AES_KEY key; char out[16]; size_t bc = len / 16; char *cbuf = (char *)buffer; if(NULL == buffer || len % 16 != 0) return false; AES_set_decrypt_key((const unsigned char*)aes_ukey, 128, &key); for(size_t i = 0 ; i < bc ; i ++) { AES_decrypt((const unsigned char*)(cbuf + i * 16), (unsigned char*)out, &key); memcpy(cbuf + i * 16, out, 16); } return true;}
开发者ID:hefangshi,项目名称:hack-of-zhunru,代码行数:18,
示例19: My_AES_CBC_Decryptvoid My_AES_CBC_Decrypt(u8 * key, u8 *InputMessage, u32 InputMessageLength, u8 *OutputMessage){ u8 *InBuf_ptr = InputMessage; AES_KEY ass_key; int length_in_pad = 0; u8 iv[CRL_AES_BLOCK] = {0}; int i; for(i = 0; i < CRL_AES_BLOCK; i++){ iv[i] = IV[i]; } memset(&ass_key, 0, sizeof(AES_KEY)); if(AES_set_decrypt_key(key, 128, &ass_key) < 0){ printf("AES_Dec set key error.../n"); return ; } AES_cbc_encrypt(InputMessage, OutputMessage, InputMessageLength, &ass_key, iv, AES_DECRYPT);}
开发者ID:oblivionangel,项目名称:EV_Power,代码行数:18,
示例20: assert//解密数据pData, 数据长度为lengthbool CCryptAes::Decrypt(const unsigned char *pEncryptData, int length, unsigned char *pPlainData){ assert(pPlainData != NULL); assert(pEncryptData != NULL); AES_KEY aes; unsigned char iv[AES_BLOCK_SIZE]; memset(iv, 0, sizeof(iv)); if (AES_set_decrypt_key(m_userKey, m_keyBits, &aes) < 0) { return false; } AES_cbc_encrypt(pEncryptData, pPlainData, length, &aes, iv, AES_DECRYPT); return true;}
开发者ID:dulton,项目名称:proxy,代码行数:19,
示例21: init_aes_unauthvoid init_aes_unauth (const char server_nonce[16], const char hidden_client_nonce[32], int encrypt) { static unsigned char buffer[64], hash[20]; memcpy (buffer, hidden_client_nonce, 32); memcpy (buffer + 32, server_nonce, 16); SHA1 (buffer, 48, aes_key_raw); memcpy (buffer + 32, hidden_client_nonce, 32); SHA1 (buffer, 64, aes_iv + 8); memcpy (buffer, server_nonce, 16); memcpy (buffer + 16, hidden_client_nonce, 32); SHA1 (buffer, 48, hash); memcpy (aes_key_raw + 20, hash, 12); memcpy (aes_iv, hash + 12, 8); memcpy (aes_iv + 28, hidden_client_nonce, 4); if (encrypt == AES_ENCRYPT) { AES_set_encrypt_key (aes_key_raw, 32*8, &aes_key); } else { AES_set_decrypt_key (aes_key_raw, 32*8, &aes_key); }}
开发者ID:AndrewShmig,项目名称:tg,代码行数:19,
示例22: openssl_decrypt_initint openssl_decrypt_init(struct openssl_decrypt **state, const char *passphrase, enum openssl_mode mode){#ifndef HAVE_CRYPTO fprintf(stderr, "This " PACKAGE_NAME " version was build " "without OpenSSL support!/n"); return -1;#endif // HAVE_CRYPTO struct openssl_decrypt *s = (struct openssl_decrypt *) calloc(1, sizeof(struct openssl_decrypt)); MD5_CTX context; unsigned char hash[16]; MD5Init(&context); MD5Update(&context, (const unsigned char *) passphrase, strlen(passphrase)); MD5Final(hash, &context); switch(mode) { case MODE_AES128_ECB:#ifdef HAVE_CRYPTO AES_set_decrypt_key(hash, 128, &s->key);#endif break; case MODE_AES128_CTR:#ifdef HAVE_CRYPTO AES_set_encrypt_key(hash, 128, &s->key);#endif break; default: abort(); } s->mode = mode; *state = s; return 0;}
开发者ID:zzilla,项目名称:media-streamer,代码行数:42,
示例23: aes_1static intaes_1(v_U32_t cryptHandle, tANI_U8 *keyBytes, tANI_U32 keyLen, tANI_U8 at[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], tANI_U8 ri[ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE], tANI_U8 b[AES_BLOCK_SIZE]) { int retVal;// AES_KEY aesKey; tANI_U8 in[AES_BLOCK_SIZE]; tANI_U8 *out; VOS_ASSERT (AES_BLOCK_SIZE == ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE*2); // Concatenate A and R[i] vos_mem_copy(in, at, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); vos_mem_copy(in + ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE, ri, ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE); out = b;#if 0 retVal = AES_set_decrypt_key(keyBytes, keyLen*8, &aesKey); if (retVal != 0) { ANI_SSM_LOG_E("AES_set_encrypt_key returned %d", retVal); assert(0 && "AES_set_encrypt_key failed!"); return ANI_E_FAILED; } AES_decrypt(in, out, &aesKey);#else retVal = vos_decrypt_AES(cryptHandle, /* Handle */ in, /* input */ out, /* output */ keyBytes); /* key */ if (retVal != 0) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "vos_decrypt_AES returned %d", retVal); }#endif return ANI_OK;}
开发者ID:JYMroid,项目名称:mi2_wlan_module,代码行数:42,
示例24: SHA1void CryptoUtils::initAESAuth (char authKey[192], char msgKey[16], qint32 encrypt) { static uchar buffer[48], hash[20]; /* Steps: 1) sha1_a = SHA1 (msg_key + substr (auth_key, 0, 32)); 2) sha1_b = SHA1 (substr (auth_key, 32, 16) + msg_key + substr (auth_key, 48, 16)); 3) sha1_с = SHA1 (substr (auth_key, 64, 32) + msg_key); 4) sha1_d = SHA1 (msg_key + substr (auth_key, 96, 32)); 5) aes_key = substr (sha1_a, 0, 8) + substr (sha1_b, 8, 12) + substr (sha1_c, 4, 12); 6) aes_iv = substr (sha1_a, 8, 12) + substr (sha1_b, 0, 8) + substr (sha1_c, 16, 4) + substr (sha1_d, 0, 8); */ memcpy (buffer, msgKey, 16); memcpy (buffer + 16, authKey, 32); SHA1 (buffer, 48, hash); memcpy (aes_key_raw, hash, 8); memcpy (aes_iv, hash + 8, 12); memcpy (buffer, authKey + 32, 16); memcpy (buffer + 16, msgKey, 16); memcpy (buffer + 32, authKey + 48, 16); SHA1 (buffer, 48, hash); memcpy (aes_key_raw + 8, hash + 8, 12); memcpy (aes_iv + 12, hash, 8); memcpy (buffer, authKey + 64, 32); memcpy (buffer + 32, msgKey, 16); SHA1 (buffer, 48, hash); memcpy (aes_key_raw + 20, hash + 4, 12); memcpy (aes_iv + 20, hash + 16, 4); memcpy (buffer, msgKey, 16); memcpy (buffer + 16, authKey + 96, 32); SHA1 (buffer, 48, hash); memcpy (aes_iv + 24, hash, 8); if (encrypt == AES_ENCRYPT) { AES_set_encrypt_key (aes_key_raw, 32*8, &aes_key); } else { AES_set_decrypt_key (aes_key_raw, 32*8, &aes_key); } Utils::secureZeroMemory (aes_key_raw, 0, sizeof (aes_key_raw));}
开发者ID:KAMiKAZOW,项目名称:libqtelegram-aseman-edition,代码行数:42,
示例25: decryptPassword/** * Decrypt a password that is stored inthe MaxScale configuration file. * If the password is not encrypted, ie is not a HEX string, then the * original is returned, this allows for backward compatibility with * unencrypted password. * * Note the return is always a malloc'd string that the caller must free * * @param crypt The encrypted password * @return The decrypted password */char *decryptPassword(char *crypt){MAXKEYS *keys;AES_KEY aeskey;unsigned char *plain;char *ptr;unsigned char encrypted[80];int enlen; keys = secrets_readKeys(NULL); if (!keys) return strdup(crypt); /* ** If the input is not a HEX string return the input ** it probably was not encrypted */ for (ptr = crypt; *ptr; ptr++) { if (!isxdigit(*ptr)) { free(keys); return strdup(crypt); } } enlen = strlen(crypt) / 2; gw_hex2bin(encrypted, crypt, strlen(crypt)); if ((plain = (unsigned char *)malloc(80)) == NULL) { free(keys); return NULL; } AES_set_decrypt_key(keys->enckey, 8 * MAXSCALE_KEYLEN, &aeskey); AES_cbc_encrypt(encrypted, plain, enlen, &aeskey, keys->initvector, AES_DECRYPT); free(keys); return (char *)plain;}
开发者ID:littleyang,项目名称:MaxScale,代码行数:53,
示例26: my_aes_decryptint my_aes_decrypt(char* key, char *in, int inlen, char* out) { if(!in || !key || !out) return 0; AES_KEY aes; if(AES_set_decrypt_key((unsigned char*)key, 128, &aes) < 0) { return 0; } // int len=strlen(in), en_len=0; int en_len = 0; while(en_len<inlen) { AES_decrypt((unsigned char*)in, (unsigned char*)out, &aes); in+=AES_BLOCK_SIZE; printf("AES_BLOCK_SIZE:%d/n", AES_BLOCK_SIZE); out+=AES_BLOCK_SIZE; en_len+=AES_BLOCK_SIZE; } return 1; }
开发者ID:oblivionangel,项目名称:EV_Power,代码行数:20,
示例27: aes_init_keystatic int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { int ret; if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE || enc) ret=AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data); else ret=AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data); if(ret < 0) { EVPerr(EVP_F_AES_INIT_KEY,EVP_R_AES_KEY_SETUP_FAILED); return 0; } return 1; }
开发者ID:millken,项目名称:zhuxianB30,代码行数:20,
示例28: memcpyvoid CryptoUtils::initAESUnAuth (const char serverNonce[16], const char hiddenClientNonce[32], qint32 encrypt) { static uchar buffer[64], hash[20]; memcpy (buffer, hiddenClientNonce, 32); memcpy (buffer + 32, serverNonce, 16); SHA1 (buffer, 48, aes_key_raw); memcpy (buffer + 32, hiddenClientNonce, 32); SHA1 (buffer, 64, aes_iv + 8); memcpy (buffer, serverNonce, 16); memcpy (buffer + 16, hiddenClientNonce, 32); SHA1 (buffer, 48, hash); memcpy (aes_key_raw + 20, hash, 12); memcpy (aes_iv, hash + 12, 8); memcpy (aes_iv + 28, hiddenClientNonce, 4); if (encrypt == AES_ENCRYPT) { AES_set_encrypt_key (aes_key_raw, 32*8, &aes_key); } else { AES_set_decrypt_key (aes_key_raw, 32*8, &aes_key); } Utils::secureZeroMemory (aes_key_raw, 0, sizeof (aes_key_raw));}
开发者ID:KAMiKAZOW,项目名称:libqtelegram-aseman-edition,代码行数:20,
注:本文中的AES_set_decrypt_key函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AF函数代码示例 C++ AES_decrypt函数代码示例 |