Implementation
#include "PcAPIL.h"
int main(int argc, char const *argv[])
{
unsigned char encryptText[1024];
unsigned char decryptText[1024];
int sid = PcAPI_getSession("");
const char *keyName = "ARIA-256-B64";
int rtn = 0;
unsigned char *plainText = (unsigned char *)"sinsiway petra cipher";
unsigned int encryptTextLen = 1024;
unsigned int decryptTextLen = 1024;
memset(encryptText, 0, encryptTextLen);
memset(decryptText, 0, decryptTextLen);
rtn = PcAPI_encrypt_name(sid, keyName, plainText, strlen((const char *)plainText), encryptText, &encryptTextLen);
rtn = PcAPI_decrypt_name(sid, keyName, encryptText, encryptTextLen, decryptText, &decryptTextLen);
return 0;
}
The given example source code is an illustration of how to obtain a session and use encryption/decryption functions using the PetraCipher library, libpcapi.so.
The source code uses the PcAPIL.h header file to invoke the PetraCipher library. The PcAPI_getSession() function is used to obtain a session ID, and the PcAPI_encrypt_name() and PcAPI_decrypt_name() functions are used to encrypt and decrypt data.
To use the PetraCipher library, a session must first be obtained, which is then used to encrypt or decrypt data. In each function, the session ID, encryption key name, plain data, etc. are passed as parameters.
The PetraCipher library is designed for data protection and secure communication and can be used in various applications. The provided source code illustrates the basic usage of the library, and detailed instructions can be found in the library’s documentation.
Feedback
Was this page helpful?
소중한 의견 감사합니다. 귀하의 소중한 의견 부탁드립니다..
피드백을 주시면 더 나은 서비스를 제공할 수 있도록 노력하겠습니다. 귀하의 소중한 의견 부탁드립니다..