Skip to content

A Header only Custom crypto utility for C/C++ based on Openssl Crypto Library to make life easier

License

Notifications You must be signed in to change notification settings

telkomdev/c-crypsi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

c-crypsi (Crypto Utility for C and C++)

Custom crypto utility for C/C++ based on openssl crypto library to make life easier

c-crypsi CI

Install

Its header only, just import to your project

#include "crypsi.h"

int main(int argc, char** argv) {

}

c-crypsi is compatible with each other with the following libraries

Features

  • Asymmetric encryption with RSA ✔️
  • Generate RSA private and public key ✔️
  • Digital Signature with RSA private and public key using PSS ✔️
  • Symmetric encryption with AES (GCM, CBC) ✔️
  • Message authentication code with HMAC ✔️
  • Generate Hash with Common DIGEST Algorithm ✔️

Usage

C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "crypsi.h"

int main(int argc, char** argv) {
    printf("hello\n");

    char* message = "wuriyanto";

    unsigned char* dst_digest;
    int dst_digets_len;

    if(crypsi_sha512(message, strlen(message), &dst_digest, &dst_digets_len) != 0) {
        printf("digest error\n");
        return -1;
    }

    printf("message len: %d\n", dst_digets_len);

    printf("digest result: %s\n", dst_digest);

    free((void*) dst_digest);

    return 0;
}

C++

#include <iostream>
#include "crypsi.h"

int main(int argc, char** argv)
{

    const char* message = "wuriyanto";

    unsigned char* dst_digest;
    unsigned int dst_digets_len;

    if(crypsi_sha512((const unsigned char*) message, strlen(message), &dst_digest, &dst_digets_len) != 0) {
        printf("digest error\n");
        return -1;
    }

    printf("message len: %d\n", dst_digets_len);

    printf("digest result: %s\n", dst_digest);
    
    delete dst_digest;

    return 0;
}

About

A Header only Custom crypto utility for C/C++ based on Openssl Crypto Library to make life easier

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages