2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-21 18:53:15 +00:00

Adding CryptographicParameters construction to attribute values

This commit is contained in:
Tim Kelsey
2015-06-29 15:04:37 +01:00
parent a7e2084385
commit 63e55e3a06
2 changed files with 99 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ from kmip.core.attributes import ContactInformation
from kmip.core.attributes import CryptographicAlgorithm
from kmip.core.attributes import CryptographicLength
from kmip.core.attributes import CryptographicUsageMask
from kmip.core.attributes import CryptographicParameters
from kmip.core.attributes import CustomAttribute
from kmip.core.attributes import Digest
from kmip.core.attributes import Name
@@ -27,6 +28,7 @@ from kmip.core.attributes import ObjectGroup
from kmip.core.attributes import UniqueIdentifier
from kmip.core.attributes import ObjectType
from kmip.core.attributes import OperationPolicyName
from kmip.core.attributes import HashingAlgorithm
from kmip.core import utils
@@ -151,7 +153,31 @@ class AttributeValueFactory(object):
return CryptographicLength(length)
def _create_cryptographic_parameters(self, params):
raise NotImplementedError()
block_cipher_mode = None
if 'block_cipher_mode' in params:
block_cipher_mode = CryptographicParameters.BlockCipherMode(
params.get('block_cipher_mode'))
padding_method = None
if 'padding_method' in params:
padding_method = CryptographicParameters.PaddingMethod(
params.get('padding_method'))
key_role_type = None
if 'key_role_type' in params:
key_role_type = CryptographicParameters.KeyRoleType(
params.get('key_role_type'))
hashing_algorithm = None
if 'hashing_algorithm' in params:
hashing_algorithm = HashingAlgorithm(
params.get("hashing_algorithm"))
return CryptographicParameters(
block_cipher_mode=block_cipher_mode,
padding_method=padding_method,
hashing_algorithm=hashing_algorithm,
key_role_type=key_role_type)
def _create_cryptographic_domain_parameters(self, params):
raise NotImplementedError()