mirror of
https://github.com/openkmip/pykmip
synced 2025-12-24 04:04:20 +00:00
Updating support for the Enumeration primitive
This change updates the Enumeration primitive, adding a fresh implementation and documentation. An updated unit test suite for the primitive is included. Numerous changes to Enumeration usage across the library are also included to comply with the updated implementation.
This commit is contained in:
@@ -65,10 +65,9 @@ class Name(Struct):
|
||||
|
||||
class NameType(Enumeration):
|
||||
|
||||
ENUM_TYPE = enums.NameType
|
||||
|
||||
def __init__(self, value=None):
|
||||
super(Name.NameType, self).__init__(value, Tags.NAME_TYPE)
|
||||
super(Name.NameType, self).__init__(
|
||||
enums.NameType, value, Tags.NAME_TYPE)
|
||||
|
||||
def __init__(self, name_value=None, name_type=None):
|
||||
super(Name, self).__init__(tag=Tags.NAME)
|
||||
@@ -154,20 +153,17 @@ class Name(Struct):
|
||||
# 3.3
|
||||
class ObjectType(Enumeration):
|
||||
|
||||
ENUM_TYPE = enums.ObjectType
|
||||
|
||||
def __init__(self, value=None):
|
||||
super(ObjectType, self).__init__(value, Tags.OBJECT_TYPE)
|
||||
super(ObjectType, self).__init__(
|
||||
enums.ObjectType, value, Tags.OBJECT_TYPE)
|
||||
|
||||
|
||||
# 3.4
|
||||
class CryptographicAlgorithm(Enumeration):
|
||||
|
||||
ENUM_TYPE = enums.CryptographicAlgorithm
|
||||
|
||||
def __init__(self, value=None):
|
||||
super(CryptographicAlgorithm, self).__init__(
|
||||
value, Tags.CRYPTOGRAPHIC_ALGORITHM)
|
||||
enums.CryptographicAlgorithm, value, Tags.CRYPTOGRAPHIC_ALGORITHM)
|
||||
|
||||
|
||||
# 3.5
|
||||
@@ -187,7 +183,6 @@ class HashingAlgorithm(Enumeration):
|
||||
Object. See Sections 3.17 and 9.1.3.2.16 of the KMIP v1.1 specification
|
||||
for more information.
|
||||
"""
|
||||
ENUM_TYPE = enums.HashingAlgorithm
|
||||
|
||||
def __init__(self, value=HashingAlgorithmEnum.SHA_256):
|
||||
"""
|
||||
@@ -198,31 +193,29 @@ class HashingAlgorithm(Enumeration):
|
||||
(e.g., HashingAlgorithm.MD5). Optional, defaults to
|
||||
HashingAlgorithm.SHA_256.
|
||||
"""
|
||||
super(HashingAlgorithm, self).__init__(value, Tags.HASHING_ALGORITHM)
|
||||
super(HashingAlgorithm, self).__init__(
|
||||
enums.HashingAlgorithm, value, Tags.HASHING_ALGORITHM)
|
||||
|
||||
|
||||
class CryptographicParameters(Struct):
|
||||
|
||||
class BlockCipherMode(Enumeration):
|
||||
ENUM_TYPE = enums.BlockCipherMode
|
||||
|
||||
def __init__(self, value=None):
|
||||
super(CryptographicParameters.BlockCipherMode, self).__init__(
|
||||
value, Tags.BLOCK_CIPHER_MODE)
|
||||
enums.BlockCipherMode, value, Tags.BLOCK_CIPHER_MODE)
|
||||
|
||||
class PaddingMethod(Enumeration):
|
||||
ENUM_TYPE = enums.PaddingMethod
|
||||
|
||||
def __init__(self, value=None):
|
||||
super(CryptographicParameters.PaddingMethod, self).__init__(
|
||||
value, Tags.PADDING_METHOD)
|
||||
enums.PaddingMethod, value, Tags.PADDING_METHOD)
|
||||
|
||||
class KeyRoleType(Enumeration):
|
||||
ENUM_TYPE = enums.KeyRoleType
|
||||
|
||||
def __init__(self, value=None):
|
||||
super(CryptographicParameters.KeyRoleType, self).__init__(
|
||||
value, Tags.KEY_ROLE_TYPE)
|
||||
enums.KeyRoleType, value, Tags.KEY_ROLE_TYPE)
|
||||
|
||||
def __init__(self,
|
||||
block_cipher_mode=None,
|
||||
@@ -293,7 +286,6 @@ class CertificateType(Enumeration):
|
||||
Object. See Sections 2.2.1 and 3.8 of the KMIP v1.1 specification for more
|
||||
information.
|
||||
"""
|
||||
ENUM_TYPE = enums.CertificateTypeEnum
|
||||
|
||||
def __init__(self, value=CertificateTypeEnum.X_509):
|
||||
"""
|
||||
@@ -304,7 +296,8 @@ class CertificateType(Enumeration):
|
||||
value, (e.g., CertificateTypeEnum.PGP). Optional, defaults to
|
||||
CertificateTypeEnum.X_509.
|
||||
"""
|
||||
super(CertificateType, self).__init__(value, Tags.CERTIFICATE_TYPE)
|
||||
super(CertificateType, self).__init__(
|
||||
enums.CertificateTypeEnum, value, Tags.CERTIFICATE_TYPE)
|
||||
|
||||
|
||||
class DigestValue(ByteString):
|
||||
|
||||
Reference in New Issue
Block a user