mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
define print_signature_certificate()
This commit is contained in:
parent
4b5d087246
commit
074b9ee60b
@ -988,6 +988,7 @@ get_num_signatures() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
const Multifile::CertChain &Multifile::
|
const Multifile::CertChain &Multifile::
|
||||||
get_signature(int n) const {
|
get_signature(int n) const {
|
||||||
|
((Multifile *)this)->check_signatures();
|
||||||
static CertChain error_chain;
|
static CertChain error_chain;
|
||||||
nassertr(n >= 0 && n < (int)_signatures.size(), error_chain);
|
nassertr(n >= 0 && n < (int)_signatures.size(), error_chain);
|
||||||
return _signatures[n];
|
return _signatures[n];
|
||||||
@ -1127,13 +1128,36 @@ get_signature_public_key(int n) const {
|
|||||||
}
|
}
|
||||||
#endif // HAVE_OPENSSL
|
#endif // HAVE_OPENSSL
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENSSL
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Multifile::print_signature_certificate
|
||||||
|
// Access: Published
|
||||||
|
// Description: Writes the certificate for the nth signature, in
|
||||||
|
// user-readable verbose form, to the indicated stream.
|
||||||
|
// See the comments in get_num_signatures().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void Multifile::
|
||||||
|
print_signature_certificate(int n, ostream &out) const {
|
||||||
|
const CertChain &cert_chain = get_signature(n);
|
||||||
|
nassertv(!cert_chain.empty());
|
||||||
|
|
||||||
|
BIO *mbio = BIO_new(BIO_s_mem());
|
||||||
|
X509_print(mbio, cert_chain[0]._cert);
|
||||||
|
|
||||||
|
char *pp;
|
||||||
|
long pp_size = BIO_get_mem_data(mbio, &pp);
|
||||||
|
out.write(pp, pp_size);
|
||||||
|
BIO_free(mbio);
|
||||||
|
}
|
||||||
|
#endif // HAVE_OPENSSL
|
||||||
|
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Multifile::write_signature_certificate
|
// Function: Multifile::write_signature_certificate
|
||||||
// Access: Published
|
// Access: Published
|
||||||
// Description: Writes the certificate for the nth signature, in
|
// Description: Writes the certificate for the nth signature, in
|
||||||
// verbose form, to the indicated stream. See the
|
// PEM form, to the indicated stream. See the comments
|
||||||
// comments in get_num_signatures().
|
// in get_num_signatures().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void Multifile::
|
void Multifile::
|
||||||
write_signature_certificate(int n, ostream &out) const {
|
write_signature_certificate(int n, ostream &out) const {
|
||||||
@ -1141,7 +1165,13 @@ write_signature_certificate(int n, ostream &out) const {
|
|||||||
nassertv(!cert_chain.empty());
|
nassertv(!cert_chain.empty());
|
||||||
|
|
||||||
BIO *mbio = BIO_new(BIO_s_mem());
|
BIO *mbio = BIO_new(BIO_s_mem());
|
||||||
X509_print(mbio, cert_chain[0]._cert);
|
|
||||||
|
CertChain::const_iterator ci;
|
||||||
|
for (ci = cert_chain.begin(); ci != cert_chain.end(); ++ci) {
|
||||||
|
X509 *c = (*ci)._cert;
|
||||||
|
X509_print(mbio, c);
|
||||||
|
PEM_write_bio_X509(mbio, c);
|
||||||
|
}
|
||||||
|
|
||||||
char *pp;
|
char *pp;
|
||||||
long pp_size = BIO_get_mem_data(mbio, &pp);
|
long pp_size = BIO_get_mem_data(mbio, &pp);
|
||||||
|
@ -108,6 +108,7 @@ PUBLISHED:
|
|||||||
string get_signature_subject_name(int n) const;
|
string get_signature_subject_name(int n) const;
|
||||||
string get_signature_friendly_name(int n) const;
|
string get_signature_friendly_name(int n) const;
|
||||||
string get_signature_public_key(int n) const;
|
string get_signature_public_key(int n) const;
|
||||||
|
void print_signature_certificate(int n, ostream &out) const;
|
||||||
void write_signature_certificate(int n, ostream &out) const;
|
void write_signature_certificate(int n, ostream &out) const;
|
||||||
|
|
||||||
int validate_signature_certificate(int n) const;
|
int validate_signature_certificate(int n) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user