Need help using the Crypto++ library for AES256, their documentation isn't written all that well [closed]

时间秒杀一切 提交于 2020-03-18 10:22:15

问题


so I have a project for a dll file already setup and everything, what I'm trying to do is create a function inside it that basically handles decrypting/encrypting the contents of several files.

I'm currently pushing the file contents into the function as a const char*, file sizes may very per file some being quite small and others larger. the key is also being pushed into the function as a const char* aswell. and to determin if the function should encrypt or decrypt its using an int to determin which mode.

Currently I'm using something called crypto++(https://www.cryptopp.com/) but they don't seem to have good doccumentation thats easily readable so its kinda like stumbling in the dark here.

below is the current function I have, I'm sorta lost on how to go about writing this function to do what I've describbed. I've tried with another library called tiny-aes-c but from what I can tell it would never be able to serve the purpose I need it to.

int mode - should we decrypt or encrypt the string
const char* - the key used for decrypting/encrypting the string
const char* - the string we want to decrypt/encrypt

if the mode is 1, it will store the encrypted const char* in the output variable.
if the mode is 0, it will store the decrypted const char* instead.
const char* Crypt_Wrapper(int mode,const char* key,const char* string){
    // this section is where I'm having the problem, I'm having trouble finding an example thats actually explaining how to go about handling decrypting/encrypting a const char*


    //I'm having trouble also finding the actual function needed for doing the encryption and decryption.
    if(mode == 1){
        output = aes256_encrypt_function();
    }else{
        output = aes256_decrypt_function();
    }
    return output;
}

来源:https://stackoverflow.com/questions/60574380/need-help-using-the-crypto-library-for-aes256-their-documentation-isnt-writt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!