2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-16 00:04:26 +00:00

Added SQLAlchemy Code for X509 Certificates

The code for persisting X509 certificates in a database has been added
along with the corresponding unit tests.
This commit is contained in:
Nathan Reller
2016-02-19 13:49:12 -05:00
parent 3a4de2121d
commit 043553c0e0
2 changed files with 315 additions and 20 deletions

View File

@@ -686,6 +686,17 @@ class Certificate(CryptographicObject):
names: The list of string names of the Certificate.
"""
__tablename__ = 'certificates'
unique_identifier = Column('uid', Integer,
ForeignKey('crypto_objects.uid'),
primary_key=True)
certificate_type = Column(
'certificate_type', sql.EnumType(enums.CertificateTypeEnum))
__mapper_args__ = {
'polymorphic_identity': 'Certificate'
}
@abstractmethod
def __init__(self, certificate_type, value, masks=None,
name='Certificate'):
@@ -774,6 +785,15 @@ class X509Certificate(Certificate):
names: The list of string names of the Certificate.
"""
__tablename__ = 'x509_certificates'
unique_identifier = Column('uid', Integer,
ForeignKey('certificates.uid'),
primary_key=True)
__mapper_args__ = {
'polymorphic_identity': 'Certificate'
}
def __init__(self, value, masks=None, name='X.509 Certificate'):
"""
Create an X509Certificate.
@@ -820,6 +840,10 @@ class X509Certificate(Certificate):
return NotImplemented
event.listen(X509Certificate._names, 'append',
sql.attribute_append_factory("name_index"), retval=False)
class SecretData(CryptographicObject):
"""
The SecretData class of the simplified KMIP object hierarchy.