diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-09-29 09:10:44 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-09-29 09:10:44 +0100 |
| commit | f0d2a59b20021d3582727978050641eaa8ccee30 (patch) | |
| tree | b4f952c3335f482cfd12e5eb916f96cc25161285 /src | |
| parent | ee2b60a4aee4c9730f6c49b96498d040d242bdd4 (diff) | |
Add common_name().
Diffstat (limited to 'src')
| -rw-r--r-- | src/certificates.cc | 8 | ||||
| -rw-r--r-- | src/certificates.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/certificates.cc b/src/certificates.cc index 4c41ebba..f23dbc5d 100644 --- a/src/certificates.cc +++ b/src/certificates.cc @@ -194,6 +194,14 @@ Certificate::subject () const } string +Certificate::common_name () const +{ + assert (_certificate); + + return get_name_part (X509_get_subject_name (_certificate), NID_commonName); +} + +string Certificate::serial () const { assert (_certificate); diff --git a/src/certificates.h b/src/certificates.h index 198773f1..2bf8d0db 100644 --- a/src/certificates.h +++ b/src/certificates.h @@ -58,6 +58,7 @@ public: std::string issuer () const; std::string serial () const; std::string subject () const; + std::string common_name () const; /** @return RSA public key from this Certificate. Caller must not free the returned value. */ RSA* public_key () const; |
