kmip/core/objects.py
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the Nonce 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.

        Raises:
            ValueError: Raised if the nonce ID or nonce value is missing from
                the encoding.
        """
        super(Nonce, self).read(input_stream, kmip_version=kmip_version)
        local_stream = BytearrayStream(input_stream.read(self.length))

        if self.is_tag_next(enums.Tags.NONCE_ID, local_stream):
            self._nonce_id = primitives.ByteString(
                tag=enums.Tags.NONCE_ID
            )
            self._nonce_id.read(local_stream, kmip_version=kmip_version)
        else:
            raise ValueError(
                "Nonce encoding missing the nonce ID."
            )

        if self.is_tag_next(enums.Tags.NONCE_VALUE, local_stream):
            self._nonce_value = primitives.ByteString(
                tag=enums.Tags.NONCE_VALUE
            )
            self._nonce_value.read(local_stream, kmip_version=kmip_version)
        else:
            raise ValueError(
                "Nonce encoding missing the nonce value."
            )

        self.is_oversized(local_stream)
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
        """
        Read the data encoding the Nonce 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.

        Raises:
            ValueError: Raised if the nonce ID or nonce value is missing from
                the encoding.
        """
        super(Nonce, self).read(input_stream, kmip_version=kmip_version)
        local_stream = BytearrayStream(input_stream.read(self.length))

        if self.is_tag_next(enums.Tags.NONCE_ID, local_stream):
            self._nonce_id = primitives.ByteString(
                tag=enums.Tags.NONCE_ID
            )
            self._nonce_id.read(local_stream, kmip_version=kmip_version)
        else:
            raise ValueError(
                "Nonce encoding missing the nonce ID."
            )

        if self.is_tag_next(enums.Tags.NONCE_VALUE, local_stream):
            self._nonce_value = primitives.ByteString(
                tag=enums.Tags.NONCE_VALUE
            )
            self._nonce_value.read(local_stream, kmip_version=kmip_version)
        else:
            raise ValueError(
                "Nonce encoding missing the nonce value."
            )

        self.is_oversized(local_stream)
Read the data encoding the Nonce 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.

        Raises:
            ValueError: Raised if the nonce ID or nonce value is missing from
                the encoding.