|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CERTIFICATEINFO_H |
|
#define CERTIFICATEINFO_H |
|
|
|
#include <memory> |
|
#include <ctime> |
|
#include "goo/GooString.h" |
|
#include "poppler_private_export.h" |
|
|
|
enum CertificateKeyUsageExtension |
|
{ |
|
KU_DIGITAL_SIGNATURE = 0x80, |
|
KU_NON_REPUDIATION = 0x40, |
|
KU_KEY_ENCIPHERMENT = 0x20, |
|
KU_DATA_ENCIPHERMENT = 0x10, |
|
KU_KEY_AGREEMENT = 0x08, |
|
KU_KEY_CERT_SIGN = 0x04, |
|
KU_CRL_SIGN = 0x02, |
|
KU_ENCIPHER_ONLY = 0x01, |
|
KU_NONE = 0x00 |
|
}; |
|
|
|
enum PublicKeyType |
|
{ |
|
RSAKEY, |
|
DSAKEY, |
|
ECKEY, |
|
OTHERKEY |
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum class KeyLocation |
|
{ |
|
Unknown, |
|
Other, |
|
Computer, |
|
HardwareToken |
|
}; |
|
|
|
class POPPLER_PRIVATE_EXPORT X509CertificateInfo |
|
{ |
|
public: |
|
X509CertificateInfo(); |
|
~X509CertificateInfo(); |
|
|
|
X509CertificateInfo(const X509CertificateInfo &) = delete; |
|
X509CertificateInfo &operator=(const X509CertificateInfo &) = delete; |
|
|
|
struct PublicKeyInfo |
|
{ |
|
PublicKeyInfo() = default; |
|
|
|
PublicKeyInfo(PublicKeyInfo &&) noexcept = default; |
|
PublicKeyInfo &operator=(PublicKeyInfo &&) noexcept = default; |
|
|
|
PublicKeyInfo(const PublicKeyInfo &) = delete; |
|
PublicKeyInfo &operator=(const PublicKeyInfo &) = delete; |
|
|
|
GooString publicKey; |
|
PublicKeyType publicKeyType = OTHERKEY; |
|
unsigned int publicKeyStrength = 0; |
|
}; |
|
|
|
struct EntityInfo |
|
{ |
|
EntityInfo() = default; |
|
~EntityInfo() = default; |
|
|
|
EntityInfo(EntityInfo &&) noexcept = default; |
|
EntityInfo &operator=(EntityInfo &&) noexcept = default; |
|
|
|
EntityInfo(const EntityInfo &) = delete; |
|
EntityInfo &operator=(const EntityInfo &) = delete; |
|
|
|
std::string commonName; |
|
std::string distinguishedName; |
|
std::string email; |
|
std::string organization; |
|
}; |
|
|
|
struct Validity |
|
{ |
|
Validity() : notBefore(0), notAfter(0) { } |
|
|
|
time_t notBefore; |
|
time_t notAfter; |
|
}; |
|
|
|
|
|
int getVersion() const; |
|
const GooString &getSerialNumber() const; |
|
const GooString &getNickName() const; |
|
const EntityInfo &getIssuerInfo() const; |
|
const Validity &getValidity() const; |
|
const EntityInfo &getSubjectInfo() const; |
|
const PublicKeyInfo &getPublicKeyInfo() const; |
|
unsigned int getKeyUsageExtensions() const; |
|
const GooString &getCertificateDER() const; |
|
bool getIsSelfSigned() const; |
|
KeyLocation getKeyLocation() const; |
|
|
|
|
|
void setVersion(int); |
|
void setSerialNumber(const GooString &); |
|
void setNickName(const GooString &); |
|
void setIssuerInfo(EntityInfo &&); |
|
void setValidity(Validity); |
|
void setSubjectInfo(EntityInfo &&); |
|
void setPublicKeyInfo(PublicKeyInfo &&); |
|
void setKeyUsageExtensions(unsigned int); |
|
void setCertificateDER(const GooString &); |
|
void setIsSelfSigned(bool); |
|
void setKeyLocation(KeyLocation location); |
|
|
|
private: |
|
EntityInfo issuer_info; |
|
EntityInfo subject_info; |
|
PublicKeyInfo public_key_info; |
|
Validity cert_validity; |
|
GooString cert_serial; |
|
GooString cert_der; |
|
GooString cert_nick; |
|
unsigned int ku_extensions; |
|
int cert_version; |
|
bool is_self_signed; |
|
KeyLocation keyLocation; |
|
}; |
|
|
|
#endif |
|
|