/********************************************************************************* * Copyright: (C) 2018 LingYun IoT System Studio * All rights reserved. * * Filename: main.c * Description: This file is LingYun Crypto library test program * * Version: 1.0.0(2018年12月20日) * Author: Guo Wenxue * ChangeLog: 1, Release initial version on "2018年12月20日 12时33分32秒" * ********************************************************************************/ #include #include #include "crypto.h" int main(int argc, char *argv[]) { char *message="abcdefghijklmnopq"; char ciphertext[64]; char plaintext[64]; memset(ciphertext, 0, sizeof(ciphertext)); if( encrypt(message, ciphertext, sizeof(ciphertext))< 0 ) { printf("encrypt plaintext failure\n"); return -1; } printf("encrypt ciphertext: %s\n", ciphertext); memset(plaintext, 0, sizeof(plaintext)); if( decrypt(ciphertext, plaintext, sizeof(plaintext))< 0 ) { printf("decrypt ciphertext failure\n"); return -1; } printf("decrypt plaintext: %s\n", plaintext); return 0; }