docstring
stringlengths
52
499
function
stringlengths
67
35.2k
__index_level_0__
int64
52.6k
1.16M
Write the encoding of the Boolean object to the output stream. Args: ostream (Stream): A buffer to contain the encoded bytes of a Boolean object. Usually a BytearrayStream object. Required. kmip_version (KMIPVersion): An enumeration defining the KMIP vers...
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(Boolean, self).write(ostream, kmip_version=kmip_version) self.write_value(ostream, kmip_version=kmip_version)
380,763
Create a DateTime. Args: value (int): The value of the DateTime in number of seconds since the Epoch. See the time package for additional information. Optional, defaults to the current time. tag (Tags): An enumeration defining the tag of the LongInteger. ...
def __init__(self, value=None, tag=enums.Tags.DEFAULT): if value is None: value = int(time.time()) super(DateTime, self).__init__(value, tag) self.type = enums.Types.DATE_TIME
380,779
Create a Key object. Args: key_wrapping_data(dict): A dictionary containing key wrapping data settings, describing how the key value has been wrapped. Optional, defaults to None.
def __init__(self, key_wrapping_data=None): super(Key, self).__init__() self.cryptographic_algorithm = None self.cryptographic_length = None self.key_format_type = None self.key_wrapping_data = key_wrapping_data # All remaining attributes are not considered par...
380,805
Create a Certificate. Args: certificate_type(CertificateType): An enumeration defining the type of the certificate. value(bytes): The bytes representing the certificate. masks(list): A list of CryptographicUsageMask enumerations defining how t...
def __init__(self, certificate_type, value, masks=None, name='Certificate'): super(Certificate, self).__init__() self._object_type = enums.ObjectType.CERTIFICATE self.value = value self.certificate_type = certificate_type self.names = [name] i...
380,814
Create an X509Certificate. Args: value(bytes): The bytes representing the certificate. masks(list): A list of CryptographicUsageMask enumerations defining how the certificate will be used. name(string): The string name of the certificate.
def __init__(self, value, masks=None, name='X.509 Certificate'): super(X509Certificate, self).__init__( enums.CertificateType.X_509, value, masks, name) # All remaining attributes are not considered part of the public API # and are subject to change. # The followin...
380,815
Create a SecretData object. Args: value(bytes): The bytes representing secret data. data_type(SecretDataType): An enumeration defining the type of the secret value. masks(list): A list of CryptographicUsageMask enumerations defining how the ke...
def __init__(self, value, data_type, masks=None, name='Secret Data'): super(SecretData, self).__init__() self._object_type = enums.ObjectType.SECRET_DATA self.value = value self.data_type = data_type self.names = [name] if masks: self.cryptographic...
380,817
Create a OpaqueObject. Args: value(bytes): The bytes representing opaque data. opaque_type(OpaqueDataType): An enumeration defining the type of the opaque value. name(string): The string name of the opaque object.
def __init__(self, value, opaque_type, name='Opaque Object'): super(OpaqueObject, self).__init__() self._object_type = enums.ObjectType.OPAQUE_DATA self.value = value self.opaque_type = opaque_type self.names.append(name) # All remaining attributes are not con...
380,821
A utility function that converts an attribute name string into the corresponding attribute tag. For example: 'State' -> enums.Tags.STATE Args: value (string): The string name of the attribute. Returns: enum: The Tags enumeration value that corresponds to the attribute name...
def convert_attribute_name_to_tag(value): if not isinstance(value, six.string_types): raise ValueError("The attribute name must be a string.") for entry in attribute_name_tag_table: if value == entry[0]: return entry[1] raise ValueError("Unrecognized attribute name: '{}'"....
380,830
A utility function that converts an attribute tag into the corresponding attribute name string. For example: enums.Tags.STATE -> 'State' Args: value (enum): The Tags enumeration value of the attribute. Returns: string: The attribute name string that corresponds to the attribute ...
def convert_attribute_tag_to_name(value): if not isinstance(value, Tags): raise ValueError("The attribute tag must be a Tags enumeration.") for entry in attribute_name_tag_table: if value == entry[1]: return entry[0] raise ValueError("Unrecognized attribute tag: {}".format...
380,831
A utility function that computes a bit mask from a collection of enumeration values. Args: enumerations (list): A list of enumeration values to be combined in a composite bit mask. Returns: int: The composite bit mask.
def get_bit_mask_from_enumerations(enumerations): return functools.reduce( lambda x, y: x | y, [z.value for z in enumerations] )
380,832
A utility function that creates a list of enumeration values from a bit mask for a specific mask enumeration class. Args: enumeration (class): The enumeration class from which to draw enumeration values. mask (int): The bit mask from which to identify enumeration values. Return...
def get_enumerations_from_bit_mask(enumeration, mask): return [x for x in enumeration if (x.value & mask) == x.value]
380,833
Read the data encoding the CreateKeyPair request payload and decode it into its constituent parts. Args: input_buffer (stream): A data buffer containing encoded object data, supporting a read method. kmip_version (KMIPVersion): An enumeration defining the KMIP ...
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): super(CreateKeyPairRequestPayload, self).read( input_buffer, kmip_version=kmip_version ) local_buffer = utils.BytearrayStream(input_buffer.read(self.length)) if kmip_version < enums.K...
380,840
Write the data encoding the CreateKeyPair request payload to a buffer. Args: output_buffer (stream): A data buffer in which to encode object data, supporting a write method. kmip_version (KMIPVersion): An enumeration defining the KMIP version with which t...
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): local_buffer = utils.BytearrayStream() if kmip_version < enums.KMIPVersion.KMIP_2_0: if self._common_template_attribute is not None: self._common_template_attribute.write( l...
380,841
Read the data encoding the GetAttributeList request payload and decode it into its constituent parts. Args: input_buffer (stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_versi...
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): super(GetAttributeListRequestPayload, self).read( input_buffer, kmip_version=kmip_version ) local_buffer = utils.BytearrayStream(input_buffer.read(self.length)) if self.is_tag_next(en...
380,853
Write the data encoding the GetAttributeList request payload to a stream. Args: output_buffer (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enume...
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): local_buffer = utils.BytearrayStream() if self._unique_identifier: self._unique_identifier.write( local_buffer, kmip_version=kmip_version ) self.length = lo...
380,854
Construct a GetAttributeList response payload. Args: unique_identifier (string): The ID of the managed object with which the retrieved attribute names should be associated. Optional, defaults to None. attribute_names: A list of strings identifying the nam...
def __init__(self, unique_identifier=None, attribute_names=None): super(GetAttributeListResponsePayload, self).__init__( enums.Tags.RESPONSE_PAYLOAD ) self._unique_identifier = None self._attribute_names = list() self.unique_identifier = unique_identifier ...
380,856
Construct a Create request payload structure. Args: object_type (enum): An ObjectType enumeration specifying the type of object to create. Optional, defaults to None. Required for read/write. template_attribute (TemplateAttribute): A TemplateAttribute ...
def __init__(self, object_type=None, template_attribute=None): super(CreateRequestPayload, self).__init__( tag=enums.Tags.REQUEST_PAYLOAD ) self._object_type = None self._template_attribute = None self.object_type = object_...
380,889
Convert a Pie object into a core secret object and vice versa. Args: obj (various): A Pie or core secret object to convert into the opposite object space. Required. Raises: TypeError: if the object type is unrecognized or unsupported.
def convert(self, obj): if isinstance(obj, pobjects.SymmetricKey): return self._build_core_key(obj, secrets.SymmetricKey) elif isinstance(obj, secrets.SymmetricKey): return self._build_pie_key(obj, pobjects.SymmetricKey) elif isinstance(obj, pobjects.PublicKey): ...
380,902
Create an AttributePolicy. Args: version (ProtocolVersion): The KMIP protocol version under which this set of attribute policies should be evaluated. Required.
def __init__(self, version): self._version = version self._attribute_rule_sets = { 'Unique Identifier': AttributeRuleSet( True, ('server', ), False, False, False, False, ...
380,928
Check if the attribute is supported by the current KMIP version. Args: attribute (string): The name of the attribute (e.g., 'Cryptographic Algorithm'). Required. Returns: bool: True if the attribute is supported by the current KMIP version. False ...
def is_attribute_supported(self, attribute): if attribute not in self._attribute_rule_sets.keys(): return False rule_set = self._attribute_rule_sets.get(attribute) if self._version >= rule_set.version_added: return True else: return False
380,929
Check if the attribute is deprecated by the current KMIP version. Args: attribute (string): The name of the attribute (e.g., 'Unique Identifier'). Required.
def is_attribute_deprecated(self, attribute): rule_set = self._attribute_rule_sets.get(attribute) if rule_set.version_deprecated: if self._version >= rule_set.version_deprecated: return True else: return False else: ret...
380,930
Check if the attribute is supported by the given object type. Args: attribute (string): The name of the attribute (e.g., 'Name'). Required. object_type (ObjectType): An ObjectType enumeration (e.g., ObjectType.SYMMETRIC_KEY). Required. Returns: ...
def is_attribute_applicable_to_object_type(self, attribute, object_type): # TODO (peterhamilton) Handle applicability between certificate types rule_set = self._attribute_rule_sets.get(attribute) if object_type in rule_set.applies_to_object_types: return True else: ...
380,931
Check if the attribute is allowed to have multiple instances. Args: attribute (string): The name of the attribute (e.g., 'State'). Required.
def is_attribute_multivalued(self, attribute): # TODO (peterhamilton) Handle multivalue swap between certificate types rule_set = self._attribute_rule_sets.get(attribute) return rule_set.multiple_instances_permitted
380,932
Construct a CertificateValue byte string. Args: value (bytes): A byte string (e.g., b'\x00\x01...') containing the certificate bytes to store. Optional, defaults to the empty byte string.
def __init__(self, value=b''): super(CertificateValue, self).__init__(value, Tags.CERTIFICATE_VALUE)
380,933
Construct an Offset object. Args: value (int): An integer representing a positive change in time. Optional, defaults to None.
def __init__(self, value=None): super(Offset, self).__init__(value, Tags.OFFSET)
380,934
Construct a QueryFunction object. Args: value (QueryFunction enum): A QueryFunction enumeration value, (e.g., QueryFunction.QUERY_OPERATIONS). Optional, default to None.
def __init__(self, value=None): super(QueryFunction, self).__init__( QueryFunctionEnum, value, Tags.QUERY_FUNCTION)
380,935
Construct a VendorIdentification object. Args: value (str): A string describing a KMIP vendor. Optional, defaults to None.
def __init__(self, value=None): super(VendorIdentification, self).__init__( value, Tags.VENDOR_IDENTIFICATION)
380,936
Construct a KeyFormatType object. Args: value (KeyFormatType): A KeyFormatType enumeration value, (e.g., KeyFormatType.PKCS_1). Optional, default to KeyFormatType.RAW.
def __init__(self, value=KeyFormatTypeEnum.RAW): super(KeyFormatType, self).__init__( KeyFormatTypeEnum, value, Tags.KEY_FORMAT_TYPE)
380,939
Construct an AttributeReference structure. Args: vendor_identification (string): A string identifying the vendor associated with the attribute. Optional, defaults to None. Required for read/write. attribute_name (string): A string containing the attribute...
def __init__(self, vendor_identification=None, attribute_name=None): super(AttributeReference, self).__init__( tag=enums.Tags.ATTRIBUTE_REFERENCE ) self._vendor_identification = None self._attribute_name = None self.vendor_identification = vendor_identifica...
380,962
Construct a Nonce struct. Args: nonce_id (bytes): A binary string representing the ID of the nonce value. Optional, defaults to None. Required for encoding and decoding. nonce_value (bytes): A binary string representing a random value. Opt...
def __init__(self, nonce_id=None, nonce_value=None): super(Nonce, self).__init__(tag=enums.Tags.NONCE) self._nonce_id = None self._nonce_value = None self.nonce_id = nonce_id self.nonce_value = nonce_value
380,976
Construct a UsernamePasswordCredential struct. Args: username (string): The username identifying the credential. Optional, defaults to None. Required for encoding and decoding. password (string): The password associated with the username. Optional, defaul...
def __init__(self, username=None, password=None): super(UsernamePasswordCredential, self).__init__( tag=Tags.CREDENTIAL_VALUE ) self._username = None self._password = None self.username = username self.password = password
380,984
Read the data encoding the DeviceCredential struct and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version (KMIPV...
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(DeviceCredential, self).read( input_stream, kmip_version=kmip_version ) local_stream = BytearrayStream(input_stream.read(self.length)) if self.is_tag_next(enums.Tags.DEVICE_SERI...
380,997
Write the data encoding the DeviceCredential struct to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining t...
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): local_stream = BytearrayStream() if self._device_serial_number is not None: self._device_serial_number.write( local_stream, kmip_version=kmip_version ) if se...
380,998
Construct a Credential struct. Args: credential_type (CredentialType): An enumeration value that specifies the type of the credential struct. Optional, defaults to None. Required for encoding and decoding. credential_value (CredentialValue): The credentia...
def __init__(self, credential_type=None, credential_value=None): super(Credential, self).__init__(tag=Tags.CREDENTIAL) self._credential_type = None self._credential_value = None self.credential_type = credential_type self.credential_value = credential_value
381,012
Read the data encoding the MACSignatureKeyInformation struct and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_vers...
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(MACSignatureKeyInformation, self).read( input_stream, kmip_version=kmip_version ) local_stream = BytearrayStream(input_stream.read(self.length)) if self.is_tag_next(enums.Tags.U...
381,033
Write the data encoding the MACSignatureKeyInformation struct to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enum...
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): local_stream = BytearrayStream() if self._unique_identifier: self._unique_identifier.write( local_stream, kmip_version=kmip_version ) else: raise...
381,034
Read the data encoding the KeyWrappingData struct and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version (KMIPVe...
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(KeyWrappingData, self).read( input_stream, kmip_version=kmip_version ) local_stream = BytearrayStream(input_stream.read(self.length)) if self.is_tag_next(enums.Tags.WRAPPING_MET...
381,042
Write the data encoding the KeyWrappingData struct to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining th...
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): local_stream = BytearrayStream() if self._wrapping_method: self._wrapping_method.write( local_stream, kmip_version=kmip_version ) else: raise Val...
381,043
Read the data encoding the KeyWrappingSpecification struct and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_versio...
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(KeyWrappingSpecification, self).read( input_stream, kmip_version=kmip_version ) local_stream = BytearrayStream(input_stream.read(self.length)) if self.is_tag_next(enums.Tags.WRA...
381,052
Write the data encoding the KeyWrappingSpecification struct to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumer...
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): local_stream = BytearrayStream() if self._wrapping_method: self._wrapping_method.write( local_stream, kmip_version=kmip_version ) else: raise Val...
381,053
Construct an ExtensionName object. Args: value (str): The string data representing the extension name. Optional, defaults to the empty string.
def __init__(self, value=''): super(ExtensionName, self).__init__(value, Tags.EXTENSION_NAME)
381,064
Construct an ExtensionTag object. Args: value (int): A number representing the extension tag. Often displayed in hex format. Optional, defaults to 0.
def __init__(self, value=0): super(ExtensionTag, self).__init__(value, Tags.EXTENSION_TAG)
381,065
Construct an ExtensionType object. Args: value (Types): A number representing a Types enumeration value, indicating the type of the extended Object. Optional, defaults to None.
def __init__(self, value=None): super(ExtensionType, self).__init__(value, Tags.EXTENSION_TYPE)
381,066
Construct an ExtensionInformation object. Args: extension_name (ExtensionName): The name of the extended Object. extension_tag (ExtensionTag): The tag of the extended Object. extension_type (ExtensionType): The type of the extended Object.
def __init__(self, extension_name=None, extension_tag=None, extension_type=None): super(ExtensionInformation, self).__init__(Tags.EXTENSION_INFORMATION) if extension_name is None: self.extension_name = ExtensionName() else: self.extension_name =...
381,067
Read the data encoding the ExtensionInformation object and decode it into its constituent parts. Args: istream (Stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enume...
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(ExtensionInformation, self).read( istream, kmip_version=kmip_version ) tstream = BytearrayStream(istream.read(self.length)) self.extension_name.read(tstream, kmip_version=kmip_versio...
381,068
Write the data encoding the ExtensionInformation object to a stream. Args: ostream (Stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining the KMIP ...
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): tstream = BytearrayStream() self.extension_name.write(tstream, kmip_version=kmip_version) if self.extension_tag is not None: self.extension_tag.write(tstream, kmip_version=kmip_version) if self.exte...
381,069
Construct a RevocationReason object. Parameters: code(RevocationReasonCode): revocation reason code message(string): An optional revocation message
def __init__(self, code=None, message=None): super(RevocationReason, self).__init__(tag=Tags.REVOCATION_REASON) if code is not None: self.revocation_code = RevocationReasonCode(value=code) else: self.revocation_code = RevocationReasonCode() if message is...
381,077
Read the data encoding the RevocationReason object and decode it into its constituent parts. Args: istream (Stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumerati...
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(RevocationReason, self).read(istream, kmip_version=kmip_version) tstream = BytearrayStream(istream.read(self.length)) self.revocation_code = RevocationReasonCode() self.revocation_code.read(tstream, kmip_ve...
381,078
Write the data encoding the RevocationReason object to a stream. Args: ostream (Stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining the KMIP ...
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): tstream = BytearrayStream() self.revocation_code.write(tstream, kmip_version=kmip_version) if self.revocation_message is not None: self.revocation_message.write(tstream, kmip_version=kmip_version) #...
381,079
Construct an ObjectDefaults structure. Args: object_type (enum): An ObjectType enumeration identifying the type to which the defaults pertain. Optional, defaults to None. Required for read/write. attributes (structure): An Attributes structure containing ...
def __init__(self, object_type=None, attributes=None): super(ObjectDefaults, self).__init__(tag=enums.Tags.OBJECT_DEFAULTS) self._object_type = None self._attributes = None self.object_type = object_type self.attributes = attributes
381,081
Write the data encoding the Locate request payload to a buffer. Args: output_buffer (stream): A data buffer in which to encode object data, supporting a write method. kmip_version (KMIPVersion): An enumeration defining the KMIP version with which the obje...
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): local_buffer = utils.BytearrayStream() if self._maximum_items: self._maximum_items.write(local_buffer, kmip_version=kmip_version) if self._offset_items: self._offset_items.write(local_buff...
381,162
Construct a Locate response payload structure. Args: located_items (int): An integer specifying the number of matching objects found by the server. Note that this may not equal the number of object identifiers returned in this payload. Optional, defau...
def __init__(self, located_items=None, unique_identifiers=None): super(LocateResponsePayload, self).__init__( enums.Tags.RESPONSE_PAYLOAD) self._located_items = None self._unique_identifiers = None self.located_items = located_item...
381,166
Read the data encoding the Locate response payload and decode it into its constituent parts. Args: input_buffer (stream): A data buffer containing encoded object data, supporting a read method. kmip_version (KMIPVersion): An enumeration defining the KMIP ...
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): super(LocateResponsePayload, self).read( input_buffer, kmip_version=kmip_version ) local_buffer = utils.BytearrayStream(input_buffer.read(self.length)) if self.is_tag_next(enums.Tags....
381,169
Write the data encoding the Locate response payload to a buffer. Args: output_buffer (stream): A data buffer in which to encode object data, supporting a write method. kmip_version (KMIPVersion): An enumeration defining the KMIP version with which the obj...
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): local_buffer = utils.BytearrayStream() if self._located_items: self._located_items.write(local_buffer, kmip_version=kmip_version) if self._unique_identifiers: for unique_identifier in self...
381,170
Instantiates an RSA key from bytes. Args: bytes (byte string): Bytes of RSA private key. Returns: private_key (cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey): RSA private key created from key bytes.
def _create_RSA_private_key(self, bytes): try: private_key = serialization.load_pem_private_key( bytes, password=None, backend=default_backend() ) return private_key except Excep...
381,188
Write the data encoding the Sign response to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. Raises: ValueError: Raised if the unique_identifier or...
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): local_stream = utils.BytearrayStream() if self._unique_identifier: self._unique_identifier.write( local_stream, kmip_version=kmip_version ) else: ...
381,195
Construct a GetUsageAllocation request payload struct. Args: unique_identifier (string): The ID of the managed object (e.g., a public key) to obtain a usage allocation for. Optional, defaults to None. usage_limits_count (int): The number of usage limits u...
def __init__(self, unique_identifier=None, usage_limits_count=None): super(GetUsageAllocationRequestPayload, self).__init__( enums.Tags.REQUEST_PAYLOAD ) self._unique_identifier = None self._usage_limits_count = None self.unique_identifier = unique_identifi...
381,200
Convert a ProtocolVersion struct to its KMIPVersion enumeration equivalent. Args: value (ProtocolVersion): A ProtocolVersion struct to be converted into a KMIPVersion enumeration. Returns: KMIPVersion: The enumeration equivalent of the struct. If the struct cannot be co...
def protocol_version_to_kmip_version(value): if not isinstance(value, ProtocolVersion): return None if value.major == 1: if value.minor == 0: return enums.KMIPVersion.KMIP_1_0 elif value.minor == 1: return enums.KMIPVersion.KMIP_1_1 elif value.minor ...
381,204
Construct a ProtocolVersion struct. Args: major (int): The major protocol version number. Optional, defaults to None. minor (int): The minor protocol version number. Optional, defaults to None.
def __init__(self, major=None, minor=None): super(ProtocolVersion, self).__init__(enums.Tags.PROTOCOL_VERSION) self._major = None self._minor = None self.major = major self.minor = minor
381,205
Construct an Authentication struct. Args: credentials (list): A list of Credential structs to be used for authentication. Optional, defaults to None.
def __init__(self, credentials=None): super(Authentication, self).__init__(enums.Tags.AUTHENTICATION) self._credentials = [] self.credentials = credentials
381,219
Read the data encoding the Authentication struct and decode it into its constituent parts. Args: input_stream (stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version (KMIPVer...
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(Authentication, self).read( input_stream, kmip_version=kmip_version ) local_stream = utils.BytearrayStream(input_stream.read(self.length)) credentials = [] while self.is...
381,221
Write the data encoding the Authentication struct to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining the...
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): local_stream = utils.BytearrayStream() if len(self._credentials) == 0: raise ValueError("Authentication struct missing credentials.") for credential in self._credentials: credential.write(l...
381,222
Construct a Poll request payload struct. Args: asynchronous_correlation_value (bytes): The ID of a pending operation to poll the status of, in bytes. Optional, defaults to None.
def __init__(self, asynchronous_correlation_value=None): super(PollRequestPayload, self).__init__( enums.Tags.REQUEST_PAYLOAD ) self._asynchronous_correlation_value = None self.asynchronous_correlation_value = asynchronous_correlation_value
381,235
Construct a Certificate object. Args: certificate_type (CertificateType): The type of the certificate. Optional, defaults to None. certificate_value (bytes): The bytes of the certificate. Optional, defaults to None.
def __init__(self, certificate_type=None, certificate_value=None): super(Certificate, self).__init__(Tags.CERTIFICATE) if certificate_type is None: self.certificate_type = CertificateType() else: self.certificate_type = Certific...
381,237
Read the data encoding the Certificate object and decode it into its constituent parts. Args: istream (Stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration de...
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): super(Certificate, self).read(istream, kmip_version=kmip_version) tstream = BytearrayStream(istream.read(self.length)) self.certificate_type = CertificateType() self.certificate_value = CertificateValue() ...
381,238
Write the data encoding the Certificate object to a stream. Args: ostream (Stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining the KMIP ver...
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): tstream = BytearrayStream() self.certificate_type.write(tstream, kmip_version=kmip_version) self.certificate_value.write(tstream, kmip_version=kmip_version) self.length = tstream.length() super(Certific...
381,239
Construct a SLUGSConnector. Args: url (string): The base URL for the remote SLUGS instance. Optional, defaults to None. Required for authentication.
def __init__(self, url=None): self._url = None self.users_url = None self.groups_url = None self.url = url
381,259
Construct an Archive response payload struct. Args: unique_identifier (string): The ID of the managed object (e.g., a public key) that was archived. Optional, defaults to None.
def __init__(self, unique_identifier=None): super(ArchiveResponsePayload, self).__init__( enums.Tags.RESPONSE_PAYLOAD ) self._unique_identifier = None self.unique_identifier = unique_identifier
381,266
Write the data encoding the Rekey request payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining the...
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): local_stream = utils.BytearrayStream() if self._unique_identifier is not None: self._unique_identifier.write( local_stream, kmip_version=kmip_version ) if se...
381,280
Construct a ActivateRequestPayload object. Args: unique_identifier (UniqueIdentifier): The UUID of a managed cryptographic object.
def __init__(self, unique_identifier=None): super(ActivateRequestPayload, self).__init__( tag=enums.Tags.REQUEST_PAYLOAD) self.unique_identifier = unique_identifier self.validate()
381,286
Write the data encoding the ActivateRequestPayload object to a stream. Args: ostream (Stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining the KMIP ...
def write(self, ostream, kmip_version=enums.KMIPVersion.KMIP_1_0): tstream = BytearrayStream() # Write the contents of the request payload if self.unique_identifier is not None: self.unique_identifier.write(tstream, kmip_version=kmip_version) # Write the length and...
381,287
Set the KMIP version for the client. Args: value (KMIPVersion): A KMIPVersion enumeration Return: None Raises: ValueError: if value is not a KMIPVersion enumeration Example: >>> client.kmip_version = enums.KMIPVersion.KMIP_1_1 ...
def kmip_version(self, value): if isinstance(value, enums.KMIPVersion): self._kmip_version = value else: raise ValueError("KMIP version must be a KMIPVersion enumeration")
381,291
Check if a profile is supported by the client. Args: conformance_clause (ConformanceClause): authentication_suite (AuthenticationSuite): Returns: bool: True if the profile is supported, False otherwise. Example: >>> client.is_profile_supported( ...
def is_profile_supported(self, conformance_clause, authentication_suite): return (self.is_conformance_clause_supported(conformance_clause) and self.is_authentication_suite_supported(authentication_suite))
381,292
Send a GetAttributeList request to the server. Args: uid (string): The ID of the managed object with which the retrieved attribute names should be associated. Returns: result (GetAttributeListResult): A structure containing the results of the ope...
def get_attribute_list(self, uid=None): batch_item = self._build_get_attribute_list_batch_item(uid) request = self._build_request_message(None, [batch_item]) response = self._send_and_receive_message(request) results = self._process_batch_items(response) return results[...
381,303
Create a KmipError exception. Args: status (ResultStatus): An enumeration detailing the result outcome. reason (ResultReason): An enumeration giving the status rationale. message (string): A string containing more information about the error.
def __init__(self, status=enums.ResultStatus.OPERATION_FAILED, reason=enums.ResultReason.GENERAL_FAILURE, message='A general failure occurred.'): super(KmipError, self).__init__(message) self.status = status self.reason = reason
381,352
Create a CryptographicFailure exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(CryptographicFailure, self).__init__( reason=enums.ResultReason.CRYPTOGRAPHIC_FAILURE, message=message )
381,354
Create an EncodingOptionError. Args: message (string): A string containing information about the error.
def __init__(self, message): super(EncodingOptionError, self).__init__( reason=enums.ResultReason.ENCODING_OPTION_ERROR, message=message )
381,355
Create an IllegalOperation exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(IllegalOperation, self).__init__( reason=enums.ResultReason.ILLEGAL_OPERATION, message=message )
381,356
Create an IndexOutOfBounds exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(IndexOutOfBounds, self).__init__( reason=enums.ResultReason.INDEX_OUT_OF_BOUNDS, message=message )
381,357
Create an InvalidField exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(InvalidField, self).__init__( reason=enums.ResultReason.INVALID_FIELD, message=message )
381,358
Create an InvalidMessage exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(InvalidMessage, self).__init__( reason=enums.ResultReason.INVALID_MESSAGE, message=message )
381,359
Create an ItemNotFound exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(ItemNotFound, self).__init__( reason=enums.ResultReason.ITEM_NOT_FOUND, message=message )
381,360
Create a KeyCompressionTypeNotSupported exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(KeyCompressionTypeNotSupported, self).__init__( reason=enums.ResultReason.KEY_COMPRESSION_TYPE_NOT_SUPPORTED, message=message )
381,361
Create a KeyFormatTypeNotSupported exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(KeyFormatTypeNotSupported, self).__init__( reason=enums.ResultReason.KEY_FORMAT_TYPE_NOT_SUPPORTED, message=message )
381,362
Create an OperationNotSupported exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(OperationNotSupported, self).__init__( reason=enums.ResultReason.OPERATION_NOT_SUPPORTED, message=message )
381,363
Create a PermissionDenied exception. Args: message (string): A string containing information about the error.
def __init__(self, message): super(PermissionDenied, self).__init__( reason=enums.ResultReason.PERMISSION_DENIED, message=message )
381,364
Construct the error message and attributes for the KMIP operation failure. Args: status: a ResultStatus enumeration reason: a ResultReason enumeration message: a string providing additional error information
def __init__(self, status, reason, message): msg = "{0}: {1} - {2}".format(status.name, reason.name, message) super(KmipOperationFailure, self).__init__(msg) self.status = status self.reason = reason self.message = message
381,371
Set the KMIP version for the client. Args: value (KMIPVersion): A KMIPVersion enumeration Return: None Raises: ValueError: if value is not a KMIPVersion enumeration Example: >>> client.kmip_version = enums.KMIPVersion.KMIP_1_1 ...
def kmip_version(self, value): if isinstance(value, enums.KMIPVersion): self.proxy.kmip_version = value else: raise ValueError("KMIP version must be a KMIPVersion enumeration")
381,374
Activate a managed object stored by a KMIP appliance. Args: uid (string): The unique ID of the managed object to activate. Optional, defaults to None. Returns: None Raises: ClientConnectionNotOpen: if the client connection is unusable ...
def activate(self, uid=None): # Check input if uid is not None: if not isinstance(uid, six.string_types): raise TypeError("uid must be a string") # Activate the managed object and handle the results result = self.proxy.activate(uid) status =...
381,386
Build a CryptographicParameters struct from a dictionary. Args: value (dict): A dictionary containing the key/value pairs for a CryptographicParameters struct. Returns: None: if value is None CryptographicParameters: a CryptographicParameters struct ...
def _build_cryptographic_parameters(self, value): if value is None: return None elif not isinstance(value, dict): raise TypeError("Cryptographic parameters must be a dictionary.") cryptographic_parameters = CryptographicParameters( block_cipher_mode=...
381,392
Build an EncryptionKeyInformation struct from a dictionary. Args: value (dict): A dictionary containing the key/value pairs for a EncryptionKeyInformation struct. Returns: EncryptionKeyInformation: an EncryptionKeyInformation struct Raises: ...
def _build_encryption_key_information(self, value): if value is None: return None if not isinstance(value, dict): raise TypeError("Encryption key information must be a dictionary.") cryptographic_parameters = value.get('cryptographic_parameters') if cryp...
381,393
Build an MACSignatureKeyInformation struct from a dictionary. Args: value (dict): A dictionary containing the key/value pairs for a MACSignatureKeyInformation struct. Returns: MACSignatureInformation: a MACSignatureKeyInformation struct Raises: ...
def _build_mac_signature_key_information(self, value): if value is None: return None if not isinstance(value, dict): raise TypeError( "MAC/signature key information must be a dictionary." ) cryptographic_parameters = value.get('crypto...
381,394
Build a KeyWrappingSpecification struct from a dictionary. Args: value (dict): A dictionary containing the key/value pairs for a KeyWrappingSpecification struct. Returns: KeyWrappingSpecification: a KeyWrappingSpecification struct Raises: Ty...
def _build_key_wrapping_specification(self, value): if value is None: return None if not isinstance(value, dict): raise TypeError("Key wrapping specification must be a dictionary.") encryption_key_info = self._build_encryption_key_information( value....
381,395
Construct a QueryRequestPayload object. Args: query_functions (list): A list of QueryFunction enumerations.
def __init__(self, query_functions=None): super(QueryRequestPayload, self).__init__(enums.Tags.REQUEST_PAYLOAD) self._query_functions = None self.query_functions = query_functions
381,398
Read the data encoding the QueryResponsePayload object and decode it into its constituent parts. Args: input_buffer (Stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version (K...
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): super(QueryResponsePayload, self).read( input_buffer, kmip_version=kmip_version ) local_buffer = utils.BytearrayStream(input_buffer.read(self.length)) operations = [] while(se...
381,419
Write the data encoding the QueryResponsePayload object to a stream. Args: output_buffer (Stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defini...
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): local_buffer = utils.BytearrayStream() if self._operations: for operation in self._operations: operation.write(local_buffer, kmip_version=kmip_version) if self._object_types: ...
381,420
Construct a GetAttributes request payload. Args: unique_identifier (string): The ID of the managed object with which the retrieved attributes should be associated. Optional, defaults to None. attribute_names: A list of strings identifying the names of the...
def __init__(self, unique_identifier=None, attribute_names=None): super(GetAttributesRequestPayload, self).__init__( enums.Tags.REQUEST_PAYLOAD) self._unique_identifier = None self._attribute_names = list() self.unique_identifier = unique_identifier self.at...
381,423
Construct a GetAttributes response payload. Args: unique_identifier (string): The ID of the managed object with which the retrieved attributes should be associated. Optional, defaults to None. attributes (list): A list of attribute structures associated w...
def __init__(self, unique_identifier=None, attributes=None): super(GetAttributesResponsePayload, self).__init__( enums.Tags.RESPONSE_PAYLOAD) self._unique_identifier = None self._attributes = list() self.unique_identifier = unique_identifier self.attributes...
381,426
Read the data encoding the GetAttributes response payload and decode it into its constituent parts. Args: input_buffer (stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. kmip_version...
def read(self, input_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): super(GetAttributesResponsePayload, self).read( input_buffer, kmip_version=kmip_version ) local_buffer = utils.BytearrayStream(input_buffer.read(self.length)) if self.is_tag_next(enum...
381,428
Write the data encoding the GetAttributes response payload to a stream. Args: output_buffer (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumera...
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_0): local_buffer = utils.BytearrayStream() if self._unique_identifier: self._unique_identifier.write( local_buffer, kmip_version=kmip_version ) else: ...
381,429