kmip/core/objects.py
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_3):
        """
        Write the RNGParameters structure encoding to the data stream.

        Args:
            output_buffer (stream): A data stream in which to encode
                Attributes structure data, supporting a write method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidField: Raised if the RNG algorithm field is not defined.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the RNGParameters structure.
        """
        if kmip_version < enums.KMIPVersion.KMIP_1_3:
            raise exceptions.VersionNotSupported(
                "KMIP {} does not support the RNGParameters object.".format(
                    kmip_version.value
                )
            )

        local_buffer = BytearrayStream()

        if self._rng_algorithm:
            self._rng_algorithm.write(local_buffer, kmip_version=kmip_version)
        else:
            raise exceptions.InvalidField(
                "The RNGParameters structure is missing the RNG algorithm "
                "field."
            )

        if self._cryptographic_algorithm:
            self._cryptographic_algorithm.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._cryptographic_length:
            self._cryptographic_length.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._hashing_algorithm:
            self._hashing_algorithm.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._drbg_algorithm:
            self._drbg_algorithm.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._recommended_curve:
            self._recommended_curve.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._fips186_variation:
            self._fips186_variation.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._prediction_resistance:
            self._prediction_resistance.write(
                local_buffer,
                kmip_version=kmip_version
            )

        self.length = local_buffer.length()
        super(RNGParameters, self).write(
            output_buffer,
            kmip_version=kmip_version
        )
        output_buffer.write(local_buffer.buffer)
def write(self, output_buffer, kmip_version=enums.KMIPVersion.KMIP_1_3):
        """
        Write the RNGParameters structure encoding to the data stream.

        Args:
            output_buffer (stream): A data stream in which to encode
                Attributes structure data, supporting a write method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidField: Raised if the RNG algorithm field is not defined.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the RNGParameters structure.
        """
        if kmip_version < enums.KMIPVersion.KMIP_1_3:
            raise exceptions.VersionNotSupported(
                "KMIP {} does not support the RNGParameters object.".format(
                    kmip_version.value
                )
            )

        local_buffer = BytearrayStream()

        if self._rng_algorithm:
            self._rng_algorithm.write(local_buffer, kmip_version=kmip_version)
        else:
            raise exceptions.InvalidField(
                "The RNGParameters structure is missing the RNG algorithm "
                "field."
            )

        if self._cryptographic_algorithm:
            self._cryptographic_algorithm.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._cryptographic_length:
            self._cryptographic_length.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._hashing_algorithm:
            self._hashing_algorithm.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._drbg_algorithm:
            self._drbg_algorithm.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._recommended_curve:
            self._recommended_curve.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._fips186_variation:
            self._fips186_variation.write(
                local_buffer,
                kmip_version=kmip_version
            )

        if self._prediction_resistance:
            self._prediction_resistance.write(
                local_buffer,
                kmip_version=kmip_version
            )

        self.length = local_buffer.length()
        super(RNGParameters, self).write(
            output_buffer,
            kmip_version=kmip_version
        )
        output_buffer.write(local_buffer.buffer)
Write the RNGParameters structure encoding to the data stream.

        Args:
            output_buffer (stream): A data stream in which to encode
                Attributes structure data, supporting a write method.
            kmip_version (enum): A KMIPVersion enumeration defining the KMIP
                version with which the object will be encoded. Optional,
                defaults to KMIP 2.0.

        Raises:
            InvalidField: Raised if the RNG algorithm field is not defined.
            VersionNotSupported: Raised when a KMIP version is provided that
                does not support the RNGParameters structure.