Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7873051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:23:52+00:00 2026-06-03T02:23:52+00:00

Hi i have installed openssl on my linux machine and going through the header

  • 0

Hi i have installed openssl on my linux machine and going through the header files and documentation (which is highly insufficint 🙁 ).

i am trying to build a project(in ‘c’) which uses symmetric crypto algos (i am focusing on aes256cbc).
The problem is i am confused as in how to use the library functions in my code.

For my implementation of aes256cbc i can directly use the functions defined in the ‘aes.h’ header file(which appeared to me at the first place).

But on googling i came accross some tutorial for this which are using ‘evp.h’ functions to do this http://saju.net.in/code/misc/openssl_aes.c.txt

Is there a specific reason for this or directly accessing the aes.h functions is better.

And also if someone can point me to a good documentation/tutorial of any kind on using the crypto library of openssl will be much appreciated.

many thanks

P.S forgive me if i am being naive

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:23:53+00:00Added an answer on June 3, 2026 at 2:23 am

    Using the EVP API has the advantage that you can use the same API for all the symmetric ciphers that OpenSSL supports, in a generic way. This makes it way easier to replace the algorithm used, or make the algorithm user-configurable at a later stage. Most of the code you write is not specific to the encryption algorithm you selected.

    Here’s a simple example for encryption with AES-256 in CBC mode:

    #include <stdio.h>
    #include <openssl/evp.h>
    
    int main()
    {
        EVP_CIPHER_CTX ctx;
        unsigned char key[32] = {0};
        unsigned char iv[16] = {0};
        unsigned char in[16] = {0};
        unsigned char out[32]; /* at least one block longer than in[] */
        int outlen1, outlen2;
    
        EVP_EncryptInit(&ctx, EVP_aes_256_cbc(), key, iv);
        EVP_EncryptUpdate(&ctx, out, &outlen1, in, sizeof(in));
        EVP_EncryptFinal(&ctx, out + outlen1, &outlen2);
    
        printf("ciphertext length: %d\n", outlen1 + outlen2);
    
        return 0;
    }
    

    For simplicity, I omitted error handling.

    IMO one of the most important pieces of documentation on OpenSSL is Network Security with OpenSSL by Viega/Messier/Chandra. It is from 2002 (0.9.7), so does not cover changes to OpenSSL during the last 10 years, but it is IMO still a less painful way to learn OpenSSL than by using only the manual pages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed splunk to retrieve information from my log files and elert me
I have installed TFS Power Tools and I am trying to use the powershell
I have installed Lampp on my linux system, and I am learning symfony2, while
Using Java 1.4.2 with unlimited jurisdiction policy files installed. I have a class that
For a school project, I have installed MediaWiki on my local machine, and am
I am trying to go through a basic curl example. I have a php
I have installed my windows application that uses TeeChart ActiveX (a COM Component for
I have installed the Adobe Flash Player 10 debugger for Firefox 3 and I
I have installed on my computer C++Test only with UnitTest license (only Unit Test
I have installed php5 and mysql5 on my server , I can login to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.