Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_util.h>
#include <rz_cons.h>
#include <stdlib.h>
#include <string.h>
#include "./x509.h"
Go to the source code of this file.
|
inlinestatic |
Definition at line 38 of file x509.c.
References CLASS_UNIVERSAL, and TAG_OID.
Referenced by rz_x509_parse_algorithmidentifier().
RZ_API void rz_x509_certificate_dump | ( | RX509Certificate * | cert, |
const char * | pad, | ||
RzStrBuf * | sb | ||
) |
Definition at line 546 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, rz_x509_certificate_t::algorithmIdentifier, free(), rz_asn1_bin_t::length, NULL, pad(), rz_str_newf(), rz_strbuf_appendf(), rz_x509_tbscertificate_dump(), sb, rz_x509_certificate_t::signature, rz_asn1_string_t::string, and rz_x509_certificate_t::tbsCertificate.
Referenced by cmd_print_fromage(), and rz_pkcs7_cms_to_string().
RZ_API void rz_x509_certificate_json | ( | PJ * | pj, |
RX509Certificate * | certificate | ||
) |
Definition at line 790 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, rz_x509_certificate_t::algorithmIdentifier, rz_asn1_bin_t::binary, rz_asn1_bin_t::length, regress::m, NULL, pj_end(), pj_k(), pj_ks(), pj_o(), rz_asn1_free_string(), rz_asn1_stringify_integer(), rz_x509_tbscertificate_json(), rz_x509_certificate_t::signature, rz_asn1_string_t::string, and rz_x509_certificate_t::tbsCertificate.
Referenced by rz_pkcs7_cms_json().
RZ_API void rz_x509_crl_json | ( | PJ * | pj, |
RX509CertificateRevocationList * | crl | ||
) |
Definition at line 719 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, i, rz_x509_certificaterevocationlist::issuer, rz_x509_certificaterevocationlist::lastUpdate, rz_x509_certificaterevocationlist::length, rz_x509_certificaterevocationlist::nextUpdate, pj_a(), pj_end(), pj_k(), pj_ks(), pj_o(), rz_x509_certificaterevocationlist::revokedCertificates, rz_x509_crlentry_json(), rz_x509_name_json(), rz_x509_certificaterevocationlist::signature, and rz_asn1_string_t::string.
Referenced by rz_pkcs7_cms_json().
RZ_API char* rz_x509_crl_to_string | ( | RX509CertificateRevocationList * | crl, |
const char * | pad | ||
) |
Definition at line 592 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, free(), i, rz_x509_certificaterevocationlist::issuer, rz_x509_certificaterevocationlist::lastUpdate, rz_x509_certificaterevocationlist::length, rz_x509_certificaterevocationlist::nextUpdate, NULL, pad(), rz_x509_certificaterevocationlist::revokedCertificates, rz_str_newf(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_new(), rz_x509_crlentry_dump(), rz_x509_name_dump(), sb, rz_x509_certificaterevocationlist::signature, and rz_asn1_string_t::string.
Referenced by rz_pkcs7_cms_to_string().
void rz_x509_crlentry_dump | ( | RX509CRLEntry * | crle, |
const char * | pad, | ||
RzStrBuf * | sb | ||
) |
Definition at line 573 of file x509.c.
References rz_asn1_bin_t::binary, id, rz_asn1_bin_t::length, NULL, pad(), rz_x509_crlentry::revocationDate, rz_asn1_free_string(), rz_asn1_stringify_integer(), rz_strbuf_appendf(), sb, and rz_x509_crlentry::userCertificate.
Referenced by rz_x509_crl_to_string().
RZ_API void rz_x509_crlentry_json | ( | PJ * | pj, |
RX509CRLEntry * | crle | ||
) |
Definition at line 703 of file x509.c.
References rz_asn1_bin_t::binary, rz_asn1_bin_t::length, regress::m, NULL, pj_ks(), rz_x509_crlentry::revocationDate, rz_asn1_free_string(), rz_asn1_stringify_integer(), rz_asn1_string_t::string, and rz_x509_crlentry::userCertificate.
Referenced by rz_x509_crl_json().
|
static |
Definition at line 472 of file x509.c.
References e, rz_x509_extensions_t::extensions, i, rz_x509_extensions_t::length, pad(), rz_strbuf_appendf(), and sb.
Referenced by rz_x509_tbscertificate_dump().
RZ_API void rz_x509_extensions_json | ( | PJ * | pj, |
RX509Extensions * | exts | ||
) |
Definition at line 671 of file x509.c.
References e, rz_x509_extensions_t::extensions, i, rz_x509_extensions_t::length, regress::m, NULL, pj_a(), pj_end(), pj_kb(), pj_ks(), pj_o(), rz_asn1_free_string(), and rz_asn1_stringify_integer().
Referenced by rz_x509_tbscertificate_json().
RZ_API void rz_x509_free_algorithmidentifier | ( | RX509AlgorithmIdentifier * | ai | ) |
Definition at line 306 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, rz_x509_algorithmidentifier_t::parameters, and rz_asn1_free_string().
Referenced by rz_pkcs7_free_digestalgorithmidentifier(), rz_pkcs7_free_signerinfo(), rz_pkcs7_free_spcmessagedigest(), rz_x509_free_certificate(), rz_x509_free_crl(), rz_x509_free_subjectpublickeyinfo(), and rz_x509_free_tbscertificate().
RZ_API void rz_x509_free_certificate | ( | RX509Certificate * | certificate | ) |
Definition at line 387 of file x509.c.
References rz_x509_certificate_t::algorithmIdentifier, free(), rz_asn1_free_binary(), rz_x509_free_algorithmidentifier(), rz_x509_free_tbscertificate(), rz_x509_certificate_t::signature, and rz_x509_certificate_t::tbsCertificate.
Referenced by cmd_print_fromage(), and rz_pkcs7_free_extendedcertificatesandcertificates().
void rz_x509_free_crl | ( | RX509CertificateRevocationList * | crl | ) |
Definition at line 404 of file x509.c.
References free(), i, rz_x509_certificaterevocationlist::issuer, rz_x509_certificaterevocationlist::lastUpdate, rz_x509_certificaterevocationlist::length, rz_x509_certificaterevocationlist::nextUpdate, NULL, rz_x509_certificaterevocationlist::revokedCertificates, rz_asn1_free_string(), RZ_FREE, rz_x509_free_algorithmidentifier(), rz_x509_free_crlentry(), rz_x509_free_name(), and rz_x509_certificaterevocationlist::signature.
Referenced by rz_pkcs7_free_certificaterevocationlists().
|
static |
Definition at line 396 of file x509.c.
References free(), rz_asn1_free_binary(), and rz_asn1_free_string().
Referenced by rz_x509_free_crl().
RZ_API void rz_x509_free_extension | ( | RX509Extension * | ex | ) |
Definition at line 338 of file x509.c.
References ex, free(), rz_asn1_free_binary(), and rz_asn1_free_string().
Referenced by rz_x509_free_extensions(), and rz_x509_parse_extensions().
RZ_API void rz_x509_free_extensions | ( | RX509Extensions * | ex | ) |
Definition at line 347 of file x509.c.
References ex, free(), i, and rz_x509_free_extension().
Referenced by rz_x509_free_tbscertificate().
Definition at line 322 of file x509.c.
References i, rz_asn1_free_string(), and RZ_FREE.
Referenced by rz_pkcs7_free_issuerandserialnumber(), rz_x509_free_crl(), and rz_x509_free_tbscertificate().
RZ_API void rz_x509_free_subjectpublickeyinfo | ( | RX509SubjectPublicKeyInfo * | spki | ) |
Definition at line 361 of file x509.c.
References rz_x509_subjectpublickeyinfo_t::algorithm, rz_asn1_free_binary(), rz_x509_free_algorithmidentifier(), rz_x509_subjectpublickeyinfo_t::subjectPublicKey, rz_x509_subjectpublickeyinfo_t::subjectPublicKeyExponent, and rz_x509_subjectpublickeyinfo_t::subjectPublicKeyModule.
Referenced by rz_x509_free_tbscertificate().
RZ_API void rz_x509_free_tbscertificate | ( | RX509TBSCertificate * | tbsc | ) |
Definition at line 371 of file x509.c.
References rz_x509_tbscertificate_t::extensions, rz_x509_tbscertificate_t::issuer, rz_x509_tbscertificate_t::issuerUniqueID, rz_asn1_free_binary(), rz_asn1_free_string(), rz_x509_free_algorithmidentifier(), rz_x509_free_extensions(), rz_x509_free_name(), rz_x509_free_subjectpublickeyinfo(), rz_x509_free_validity(), rz_x509_tbscertificate_t::serialNumber, rz_x509_tbscertificate_t::signature, rz_x509_tbscertificate_t::subject, rz_x509_tbscertificate_t::subjectPublicKeyInfo, rz_x509_tbscertificate_t::subjectUniqueID, and rz_x509_tbscertificate_t::validity.
Referenced by rz_x509_free_certificate().
|
static |
Definition at line 314 of file x509.c.
References rz_x509_validity_t::notAfter, rz_x509_validity_t::notBefore, and rz_asn1_free_string().
Referenced by rz_x509_free_tbscertificate().
Definition at line 434 of file x509.c.
References i, pad(), rz_strbuf_appendf(), and sb.
Referenced by rz_x509_crl_to_string(), rz_x509_signedinfo_dump(), and rz_x509_tbscertificate_dump().
Definition at line 638 of file x509.c.
Referenced by rz_x509_crl_json(), rz_x509_signedinfo_json(), and rz_x509_tbscertificate_json().
RZ_API bool rz_x509_parse_algorithmidentifier | ( | RX509AlgorithmIdentifier * | ai, |
RASN1Object * | object | ||
) |
Definition at line 44 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, is_oid_object(), rz_asn1_list_t::length, rz_asn1_object_t::length, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, rz_x509_algorithmidentifier_t::parameters, rz_asn1_stringify_oid(), rz_return_val_if_fail, and rz_asn1_object_t::sector.
Referenced by rz_pkcs7_parse_digestalgorithmidentifier(), rz_pkcs7_parse_signerinfo(), rz_pkcs7_parse_spcmessagedigest(), rz_x509_parse_certificate(), rz_x509_parse_crl(), rz_x509_parse_subjectpublickeyinfo(), and rz_x509_parse_tbscertificate().
RZ_API RX509Certificate* rz_x509_parse_certificate | ( | RASN1Object * | object | ) |
Definition at line 217 of file x509.c.
References rz_x509_certificate_t::algorithmIdentifier, CLASS_UNIVERSAL, fail, rz_asn1_object_t::form, FORM_CONSTRUCTED, FORM_PRIMITIVE, rz_asn1_object_t::klass, rz_asn1_list_t::length, rz_asn1_object_t::length, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, rz_asn1_create_binary(), rz_asn1_free_object(), RZ_FREE, RZ_NEW0, rz_x509_parse_algorithmidentifier(), rz_x509_parse_tbscertificate(), rz_asn1_object_t::sector, rz_x509_certificate_t::signature, TAG_BITSTRING, rz_x509_certificate_t::tbsCertificate, and autogen_x86imm::tmp.
Referenced by cmd_print_fromage(), rz_pkcs7_parse_extendedcertificatesandcertificates(), and rz_x509_parse_certificate2().
RZ_API RX509Certificate* rz_x509_parse_certificate2 | ( | const ut8 * | buffer, |
ut32 | length | ||
) |
Definition at line 249 of file x509.c.
References length, NULL, rz_asn1_create_object(), and rz_x509_parse_certificate().
RZ_API RX509CertificateRevocationList* rz_x509_parse_crl | ( | RASN1Object * | object | ) |
Definition at line 275 of file x509.c.
References calloc(), free(), i, rz_x509_certificaterevocationlist::issuer, rz_x509_certificaterevocationlist::lastUpdate, rz_asn1_list_t::length, rz_x509_certificaterevocationlist::length, length, rz_asn1_object_t::list, malloc(), memset(), rz_x509_certificaterevocationlist::nextUpdate, NULL, rz_asn1_list_t::objects, rz_x509_certificaterevocationlist::revokedCertificates, rz_asn1_stringify_utctime(), rz_x509_parse_algorithmidentifier(), rz_x509_parse_crlentry(), rz_x509_parse_name(), and rz_x509_certificaterevocationlist::signature.
Referenced by rz_pkcs7_parse_certificaterevocationlists().
RZ_API RX509CRLEntry* rz_x509_parse_crlentry | ( | RASN1Object * | object | ) |
Definition at line 261 of file x509.c.
References rz_asn1_list_t::length, rz_asn1_object_t::length, rz_asn1_object_t::list, malloc(), NULL, rz_asn1_list_t::objects, rz_asn1_create_binary(), rz_asn1_stringify_utctime(), and rz_asn1_object_t::sector.
Referenced by rz_x509_parse_crl().
RZ_API bool rz_x509_parse_extension | ( | RX509Extension * | ext, |
RASN1Object * | object | ||
) |
Definition at line 122 of file x509.c.
References ext, rz_asn1_list_t::length, rz_asn1_object_t::length, rz_asn1_object_t::list, rz_asn1_list_t::objects, rz_asn1_create_binary(), rz_asn1_stringify_oid(), rz_asn1_object_t::sector, rz_asn1_object_t::tag, TAG_BOOLEAN, TAG_OCTETSTRING, and TAG_OID.
Referenced by rz_x509_parse_extensions().
RZ_API bool rz_x509_parse_extensions | ( | RX509Extensions * | ext, |
RASN1Object * | object | ||
) |
Definition at line 143 of file x509.c.
References calloc(), ext, i, rz_asn1_list_t::length, rz_asn1_object_t::length, rz_asn1_object_t::list, NULL, rz_asn1_list_t::objects, RZ_NEW0, rz_x509_free_extension(), and rz_x509_parse_extension().
Referenced by rz_x509_parse_tbscertificate().
RZ_API bool rz_x509_parse_name | ( | RX509Name * | name, |
RASN1Object * | object | ||
) |
Definition at line 79 of file x509.c.
References calloc(), CLASS_UNIVERSAL, rz_asn1_object_t::form, FORM_CONSTRUCTED, i, rz_asn1_object_t::klass, rz_asn1_list_t::length, rz_asn1_object_t::length, rz_asn1_object_t::list, rz_asn1_list_t::objects, rz_asn1_stringify_oid(), rz_asn1_stringify_string(), RZ_FREE, rz_asn1_object_t::sector, rz_asn1_object_t::tag, TAG_OID, TAG_SEQUENCE, and TAG_SET.
Referenced by rz_pkcs7_parse_issuerandserialnumber(), rz_x509_parse_crl(), and rz_x509_parse_tbscertificate().
RZ_API bool rz_x509_parse_subjectpublickeyinfo | ( | RX509SubjectPublicKeyInfo * | spki, |
RASN1Object * | object | ||
) |
Definition at line 57 of file x509.c.
References rz_x509_subjectpublickeyinfo_t::algorithm, rz_asn1_list_t::length, rz_asn1_object_t::length, rz_asn1_object_t::list, rz_asn1_list_t::objects, rz_asn1_create_binary(), rz_x509_parse_algorithmidentifier(), rz_asn1_object_t::sector, rz_x509_subjectpublickeyinfo_t::subjectPublicKey, rz_x509_subjectpublickeyinfo_t::subjectPublicKeyExponent, and rz_x509_subjectpublickeyinfo_t::subjectPublicKeyModule.
Referenced by rz_x509_parse_tbscertificate().
RZ_API bool rz_x509_parse_tbscertificate | ( | RX509TBSCertificate * | tbsc, |
RASN1Object * | object | ||
) |
Definition at line 164 of file x509.c.
References CLASS_CONTEXT, CLASS_UNIVERSAL, rz_x509_tbscertificate_t::extensions, rz_asn1_object_t::form, FORM_CONSTRUCTED, i, rz_x509_tbscertificate_t::issuer, rz_x509_tbscertificate_t::issuerUniqueID, rz_asn1_object_t::klass, rz_asn1_list_t::length, rz_asn1_object_t::length, length, rz_asn1_object_t::list, list(), rz_asn1_list_t::objects, rz_asn1_create_binary(), rz_asn1_stringify_integer(), rz_x509_parse_algorithmidentifier(), rz_x509_parse_extensions(), rz_x509_parse_name(), rz_x509_parse_subjectpublickeyinfo(), rz_x509_parse_validity(), rz_asn1_object_t::sector, rz_x509_tbscertificate_t::serialNumber, shift(), rz_x509_tbscertificate_t::signature, rz_x509_tbscertificate_t::subject, rz_x509_tbscertificate_t::subjectPublicKeyInfo, rz_x509_tbscertificate_t::subjectUniqueID, rz_asn1_object_t::tag, test-lz4-versions::tag, TAG_INTEGER, rz_x509_tbscertificate_t::validity, and rz_x509_tbscertificate_t::version.
Referenced by rz_x509_parse_certificate().
|
static |
Definition at line 10 of file x509.c.
References CLASS_UNIVERSAL, rz_asn1_object_t::form, FORM_CONSTRUCTED, FORM_PRIMITIVE, rz_asn1_object_t::klass, rz_asn1_list_t::length, rz_asn1_object_t::length, rz_asn1_object_t::list, rz_x509_validity_t::notAfter, rz_x509_validity_t::notBefore, rz_asn1_list_t::objects, rz_asn1_stringify_time(), rz_asn1_stringify_utctime(), rz_asn1_object_t::sector, rz_asn1_object_t::tag, TAG_GENERALIZEDTIME, TAG_SEQUENCE, and TAG_UTCTIME.
Referenced by rz_x509_parse_tbscertificate().
|
static |
Definition at line 450 of file x509.c.
References a, rz_x509_algorithmidentifier_t::algorithm, rz_x509_subjectpublickeyinfo_t::algorithm, rz_asn1_bin_t::binary, rz_asn1_bin_t::length, regress::m, NULL, pad(), rz_asn1_free_string(), rz_asn1_stringify_integer(), rz_strbuf_appendf(), sb, rz_asn1_string_t::string, rz_x509_subjectpublickeyinfo_t::subjectPublicKeyExponent, and rz_x509_subjectpublickeyinfo_t::subjectPublicKeyModule.
Referenced by rz_x509_tbscertificate_dump().
RZ_API void rz_x509_subjectpublickeyinfo_json | ( | PJ * | pj, |
RX509SubjectPublicKeyInfo * | spki | ||
) |
Definition at line 648 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, rz_x509_subjectpublickeyinfo_t::algorithm, rz_asn1_bin_t::binary, rz_asn1_bin_t::length, regress::m, NULL, pj_ks(), rz_asn1_free_string(), rz_asn1_stringify_integer(), rz_asn1_string_t::string, rz_x509_subjectpublickeyinfo_t::subjectPublicKeyExponent, and rz_x509_subjectpublickeyinfo_t::subjectPublicKeyModule.
Referenced by rz_x509_tbscertificate_json().
|
static |
Definition at line 495 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, rz_asn1_bin_t::binary, rz_x509_tbscertificate_t::extensions, free(), rz_x509_tbscertificate_t::issuer, rz_x509_tbscertificate_t::issuerUniqueID, rz_asn1_bin_t::length, NULL, pad(), rz_asn1_free_string(), rz_asn1_stringify_integer(), rz_str_newf(), rz_strbuf_appendf(), rz_x509_extensions_dump(), rz_x509_name_dump(), rz_x509_subjectpublickeyinfo_dump(), rz_x509_validity_dump(), sb, rz_x509_tbscertificate_t::serialNumber, rz_x509_tbscertificate_t::signature, rz_asn1_string_t::string, rz_x509_tbscertificate_t::subject, rz_x509_tbscertificate_t::subjectPublicKeyInfo, rz_x509_tbscertificate_t::subjectUniqueID, rz_x509_tbscertificate_t::validity, and rz_x509_tbscertificate_t::version.
Referenced by rz_x509_certificate_dump().
RZ_API void rz_x509_tbscertificate_json | ( | PJ * | pj, |
RX509TBSCertificate * | tbsc | ||
) |
Definition at line 744 of file x509.c.
References rz_x509_algorithmidentifier_t::algorithm, rz_asn1_bin_t::binary, rz_x509_tbscertificate_t::extensions, rz_x509_tbscertificate_t::issuer, rz_x509_tbscertificate_t::issuerUniqueID, rz_asn1_bin_t::length, regress::m, NULL, pj_end(), pj_k(), pj_ki(), pj_ks(), pj_o(), rz_asn1_free_string(), rz_asn1_stringify_integer(), rz_x509_extensions_json(), rz_x509_name_json(), rz_x509_subjectpublickeyinfo_json(), rz_x509_validity_json(), rz_x509_tbscertificate_t::serialNumber, rz_x509_tbscertificate_t::signature, rz_asn1_string_t::string, rz_x509_tbscertificate_t::subject, rz_x509_tbscertificate_t::subjectPublicKeyInfo, rz_x509_tbscertificate_t::subjectUniqueID, rz_x509_tbscertificate_t::validity, and rz_x509_tbscertificate_t::version.
Referenced by rz_x509_certificate_json().
|
static |
Definition at line 422 of file x509.c.
References a, b, rz_x509_validity_t::notAfter, rz_x509_validity_t::notBefore, pad(), rz_strbuf_appendf(), sb, and rz_asn1_string_t::string.
Referenced by rz_x509_tbscertificate_dump().
RZ_API void rz_x509_validity_json | ( | PJ * | pj, |
RX509Validity * | validity | ||
) |
Definition at line 627 of file x509.c.
References rz_x509_validity_t::notAfter, rz_x509_validity_t::notBefore, pj_ks(), and rz_asn1_string_t::string.
Referenced by rz_x509_tbscertificate_json().