pub enum SecurityPolicy {
    Unknown,
    None,
    Aes128Sha256RsaOaep,
    Basic256Sha256,
    Aes256Sha256RsaPss,
    Basic128Rsa15,
    Basic256,
}
Expand description

SecurityPolicy implies what encryption and signing algorithms and their relevant key strengths are used during an encrypted session.

Variants

Unknown

None

Aes128Sha256RsaOaep

Basic256Sha256

Aes256Sha256RsaPss

Basic128Rsa15

Basic256

Implementations

Returns true if the security policy is supported. It might be recognized but be unsupported by the implementation

Returns true if the security policy has been deprecated by the OPC UA specification

Returns the derived signature key (not the signature) size in bytes

Returns the min and max (inclusive) key length in bits

Tests if the supplied key length is valid for this policy

Creates a random nonce in a bytestring with a length appropriate for the policy

Part 6 6.7.5 Deriving keys Once the SecureChannel is established the Messages are signed and encrypted with keys derived from the Nonces exchanged in the OpenSecureChannel call. These keys are derived by passing the Nonces to a pseudo-random function which produces a sequence of bytes from a set of inputs. A pseudo-random function is represented by the following function declaration:

Byte[] PRF( Byte[] secret,  Byte[] seed,  i32 length,  i32 offset)

Where length is the number of bytes to return and offset is a number of bytes from the beginning of the sequence.

The lengths of the keys that need to be generated depend on the SecurityPolicy used for the channel. The following information is specified by the SecurityPolicy:

a) SigningKeyLength (from the DerivedSignatureKeyLength); b) EncryptingKeyLength (implied by the SymmetricEncryptionAlgorithm); c) EncryptingBlockSize (implied by the SymmetricEncryptionAlgorithm).

The parameters passed to the pseudo random function are specified in Table 33.

Table 33 – Cryptography key generation parameters

Key | Secret | Seed | Length | Offset ClientSigningKey | ServerNonce | ClientNonce | SigningKeyLength | 0 ClientEncryptingKey | ServerNonce | ClientNonce | EncryptingKeyLength | SigningKeyLength ClientInitializationVector | ServerNonce | ClientNonce | EncryptingBlockSize | SigningKeyLength + EncryptingKeyLength ServerSigningKey | ClientNonce | ServerNonce | SigningKeyLength | 0 ServerEncryptingKey | ClientNonce | ServerNonce | EncryptingKeyLength | SigningKeyLength ServerInitializationVector | ClientNonce | ServerNonce | EncryptingBlockSize | SigningKeyLength + EncryptingKeyLength

The Client keys are used to secure Messages sent by the Client. The Server keys are used to secure Messages sent by the Server.

Produce a signature of the data using an asymmetric key. Stores the signature in the supplied signature buffer. Returns the size of the signature within that buffer.

Verifies a signature of the data using an asymmetric key. In a debugging scenario, the signing key can also be supplied so that the supplied signature can be compared to a freshly generated signature.

Returns the padding algorithm used for this security policy for asymettric encryption and decryption.

Encrypts a message using the supplied encryption key, returns the encrypted size. Destination buffer must be large enough to hold encrypted bytes including any padding.

Decrypts a message whose thumbprint matches the x509 cert and private key pair.

Returns the number of decrypted bytes

Produce a signature of some data using the supplied symmetric key. Signing algorithm is determined by the security policy. Signature is stored in the supplied signature argument.

Verify the signature of a data block using the supplied symmetric key.

Encrypt the supplied data using the supplied key storing the result in the destination.

Decrypts the supplied data using the supplied key storing the result in the destination.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.