GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
ASN1_BN_PRINT(3) FreeBSD Library Functions Manual ASN1_BN_PRINT(3)

ASN1_bn_print
pretty-print a BIGNUM object

#include <openssl/asn1.h>

int
ASN1_bn_print(BIO *bio_out, const char *label, const BIGNUM *bn, unsigned char *buffer, int indent);

ASN1_bn_print() prints bn to bio_out in human-readable form. Despite its name and the header file, this function has nothing to do with ASN.1.

The caller is responsible for providing a buffer that is at least BN_num_bytes(bn) + 1 bytes long. To avoid a buffer overrun, be careful to not forget the “plus one”. It is unspecified what the buffer may contain after the function returns.

If indent is greater than zero, indent space characters are printed first, but not more than 128.

The NUL-terminated label is printed next.

After that, there are three cases:

  • If bn represents the number zero, “0” is printed.
  • If bn can be represented by the data type unsigned long, it is printed in decimal notation, followed by hexadecimal notation in parentheses, both optionally preceded by a minus sign.
  • Otherwise, the string “(Negative)” is printed if appropriate, a new output line is started, and the indentation is increased by four space characters. The bytes of the value of bn are then printed in big-endian order, each byte represented by a two-digit hexadecimal number, and each but the last byte followed by a colon. A new output line is started after every group of 15 bytes.

Finally, a newline character is printed to end the output.

If bn is a NULL pointer, all arguments are ignored and nothing is printed.

ASN1_bn_print() returns 1 if successful or if bn is a NULL pointer. It returns 0 if printing fails.

BIO_new(3), BIO_write(3), BN_is_negative(3), BN_is_zero(3), BN_new(3), BN_num_bytes(3), BN_print(3)

ASN1_bn_print() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9.
December 8, 2021 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.