kmip/core/objects.py
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
        """
        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_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to 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.WRAPPING_METHOD, local_stream):
            self._wrapping_method = primitives.Enumeration(
                enum=enums.WrappingMethod,
                tag=enums.Tags.WRAPPING_METHOD
            )
            self._wrapping_method.read(
                local_stream,
                kmip_version=kmip_version
            )
        else:
            raise ValueError(
                "Invalid struct missing the wrapping method attribute."
            )

        if self.is_tag_next(
                enums.Tags.ENCRYPTION_KEY_INFORMATION,
                local_stream
        ):
            self._encryption_key_information = EncryptionKeyInformation()
            self._encryption_key_information.read(
                local_stream,
                kmip_version=kmip_version
            )
        if self.is_tag_next(
                enums.Tags.MAC_SIGNATURE_KEY_INFORMATION,
                local_stream
        ):
            self._mac_signature_key_information = MACSignatureKeyInformation()
            self._mac_signature_key_information.read(
                local_stream,
                kmip_version=kmip_version
            )

        attribute_names = []
        while self.is_tag_next(enums.Tags.ATTRIBUTE_NAME, local_stream):
            attribute_name = primitives.TextString(
                tag=enums.Tags.ATTRIBUTE_NAME
            )
            attribute_name.read(local_stream, kmip_version=kmip_version)
            attribute_names.append(attribute_name)
        self._attribute_names = attribute_names

        if self.is_tag_next(enums.Tags.ENCODING_OPTION, local_stream):
            self._encoding_option = primitives.Enumeration(
                enum=enums.EncodingOption,
                tag=enums.Tags.ENCODING_OPTION
            )
            self._encoding_option.read(
                local_stream,
                kmip_version=kmip_version
            )

        self.is_oversized(local_stream)
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
        """
        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_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to 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.WRAPPING_METHOD, local_stream):
            self._wrapping_method = primitives.Enumeration(
                enum=enums.WrappingMethod,
                tag=enums.Tags.WRAPPING_METHOD
            )
            self._wrapping_method.read(
                local_stream,
                kmip_version=kmip_version
            )
        else:
            raise ValueError(
                "Invalid struct missing the wrapping method attribute."
            )

        if self.is_tag_next(
                enums.Tags.ENCRYPTION_KEY_INFORMATION,
                local_stream
        ):
            self._encryption_key_information = EncryptionKeyInformation()
            self._encryption_key_information.read(
                local_stream,
                kmip_version=kmip_version
            )
        if self.is_tag_next(
                enums.Tags.MAC_SIGNATURE_KEY_INFORMATION,
                local_stream
        ):
            self._mac_signature_key_information = MACSignatureKeyInformation()
            self._mac_signature_key_information.read(
                local_stream,
                kmip_version=kmip_version
            )

        attribute_names = []
        while self.is_tag_next(enums.Tags.ATTRIBUTE_NAME, local_stream):
            attribute_name = primitives.TextString(
                tag=enums.Tags.ATTRIBUTE_NAME
            )
            attribute_name.read(local_stream, kmip_version=kmip_version)
            attribute_names.append(attribute_name)
        self._attribute_names = attribute_names

        if self.is_tag_next(enums.Tags.ENCODING_OPTION, local_stream):
            self._encoding_option = primitives.Enumeration(
                enum=enums.EncodingOption,
                tag=enums.Tags.ENCODING_OPTION
            )
            self._encoding_option.read(
                local_stream,
                kmip_version=kmip_version
            )

        self.is_oversized(local_stream)
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 . WRAPPING_METHOD , local_stream ) : self . _wrapping_method = primitives . Enumeration ( enum = enums . WrappingMethod , tag = enums . Tags . WRAPPING_METHOD ) self . _wrapping_method . read ( local_stream , kmip_version = kmip_version ) else : raise ValueError ( "Invalid struct missing the wrapping method attribute." ) if self . is_tag_next ( enums . Tags . ENCRYPTION_KEY_INFORMATION , local_stream ) : self . _encryption_key_information = EncryptionKeyInformation ( ) self . _encryption_key_information . read ( local_stream , kmip_version = kmip_version ) if self . is_tag_next ( enums . Tags . MAC_SIGNATURE_KEY_INFORMATION , local_stream ) : self . _mac_signature_key_information = MACSignatureKeyInformation ( ) self . _mac_signature_key_information . read ( local_stream , kmip_version = kmip_version ) attribute_names = [ ] while self . is_tag_next ( enums . Tags . ATTRIBUTE_NAME , local_stream ) : attribute_name = primitives . TextString ( tag = enums . Tags . ATTRIBUTE_NAME ) attribute_name . read ( local_stream , kmip_version = kmip_version ) attribute_names . append ( attribute_name ) self . _attribute_names = attribute_names if self . is_tag_next ( enums . Tags . ENCODING_OPTION , local_stream ) : self . _encoding_option = primitives . Enumeration ( enum = enums . EncodingOption , tag = enums . Tags . ENCODING_OPTION ) self . _encoding_option . read ( local_stream , kmip_version = kmip_version ) self . is_oversized ( local_stream )
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_version (KMIPVersion): An enumeration defining the KMIP
                version with which the object will be decoded. Optional,
                defaults to KMIP 1.0.
Read the data encoding the KeyWrappingSpecification struct and decode it into its constituent parts .