nstool/lib/libpki/include/nn/pki/CertificateBody.h

64 lines
1.7 KiB
C
Raw Normal View History

2018-06-22 13:57:55 +00:00
#pragma once
#include <string>
2018-06-24 04:46:11 +00:00
#include <fnd/ISerialisable.h>
#include <pki/cert.h>
2018-06-22 13:57:55 +00:00
namespace pki
2018-06-22 13:57:55 +00:00
{
class CertificateBody
2018-06-24 04:46:11 +00:00
: public fnd::ISerialisable
2018-06-22 13:57:55 +00:00
{
public:
CertificateBody();
CertificateBody(const CertificateBody& other);
void operator=(const CertificateBody& other);
bool operator==(const CertificateBody& other) const;
bool operator!=(const CertificateBody& other) const;
2018-06-24 04:46:11 +00:00
// export/import binary
void toBytes();
void fromBytes(const byte_t* src, size_t size);
const fnd::Vec<byte_t>& getBytes() const;
2018-06-22 13:57:55 +00:00
2018-06-24 04:46:11 +00:00
// variables
2018-06-22 13:57:55 +00:00
void clear();
const std::string& getIssuer() const;
void setIssuer(const std::string& issuer);
pki::cert::PublicKeyType getPublicKeyType() const;
2018-06-22 13:57:55 +00:00
void setPublicKeyType(cert::PublicKeyType type);
const std::string& getSubject() const;
void setSubject(const std::string& subject);
uint32_t getCertId() const;
void setCertId(uint32_t id);
const crypto::rsa::sRsa4096Key& getRsa4098PublicKey() const;
void setRsa4098PublicKey(const crypto::rsa::sRsa4096Key& key);
const crypto::rsa::sRsa2048Key& getRsa2048PublicKey() const;
void setRsa2048PublicKey(const crypto::rsa::sRsa2048Key& key);
const crypto::ecdsa::sEcdsa240Point& getEcdsa240PublicKey() const;
void setEcdsa240PublicKey(const crypto::ecdsa::sEcdsa240Point& key);
private:
const std::string kModuleName = "CERTIFICATE_BODY";
// raw binary
2018-06-24 04:46:11 +00:00
fnd::Vec<byte_t> mRawBinary;
2018-06-22 13:57:55 +00:00
// variables
std::string mIssuer;
std::string mSubject;
uint32_t mCertId;
cert::PublicKeyType mPublicKeyType;
crypto::rsa::sRsa4096Key mRsa4096PublicKey;
crypto::rsa::sRsa2048Key mRsa2048PublicKey;
crypto::ecdsa::sEcdsa240Point mEcdsa240PublicKey;
};
}