Reader small image

You're reading from  Demystifying Cryptography with OpenSSL 3.0

Product typeBook
Published inOct 2022
PublisherPackt
ISBN-139781800560345
Edition1st Edition
Concepts
Right arrow
Author (1)
Alexei Khlebnikov
Alexei Khlebnikov
author image
Alexei Khlebnikov

Alexei Khlebnikov has more than 20 years of professional experience in IT, where he worked in different roles - software developer, system administrator, DevOps engineer, technical leader, architect and project manager. During those years Alexei worked with many technologies - Security, Artificial Intelligence, Web Development, Embedded, Mobile, and Robotics. Among other companies, Alexei worked in Opera Software on the famous Opera Internet browser. Alexei has always been interested in security. He was one of the maintainers of security-related Opera browser modules, responsible for cryptography, SSL/TLS and integration with OpenSSL. He was also a member of the Security Architects group, responsible for the security of the Opera browser. Now Alexei lives in Oslo, Norway, and works as a senior consultant for Bespoke AS. He is also the leader of the Architects group at his current employer.
Read more about Alexei Khlebnikov

Right arrow

Understanding the OpenSSL error queue

When running the rsa-encrypt program, many things can go wrong, such as the following:

  • The public key file may be corrupted or not contain a key. In this case, key loading will fail.
  • The public key file may contain a non-RSA key. In this case, key loading will succeed, but encryption will fail.
  • The input file may be too big. In this case, encryption will also fail but for another reason.

How do we handle such errors? Those OpenSSL functions that can fail usually indicate so by returning NULL, 0, or a negative number. Success is usually indicated by returning 1. Some functions also add an error to the OpenSSL error queue on failure.

The OpenSSL error queue is a container for errors that the OpenSSL library wants to report. Every thread of the process has its own OpenSSL error queue. The error queue does not require initialization or uninitialization; OpenSSL automatically handles it. Every thread starts with an empty error...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Demystifying Cryptography with OpenSSL 3.0
Published in: Oct 2022Publisher: PacktISBN-13: 9781800560345

Author (1)

author image
Alexei Khlebnikov

Alexei Khlebnikov has more than 20 years of professional experience in IT, where he worked in different roles - software developer, system administrator, DevOps engineer, technical leader, architect and project manager. During those years Alexei worked with many technologies - Security, Artificial Intelligence, Web Development, Embedded, Mobile, and Robotics. Among other companies, Alexei worked in Opera Software on the famous Opera Internet browser. Alexei has always been interested in security. He was one of the maintainers of security-related Opera browser modules, responsible for cryptography, SSL/TLS and integration with OpenSSL. He was also a member of the Security Architects group, responsible for the security of the Opera browser. Now Alexei lives in Oslo, Norway, and works as a senior consultant for Bespoke AS. He is also the leader of the Architects group at his current employer.
Read more about Alexei Khlebnikov