Opc.Ua.IssuedIdentityToken.Encrypt C# (CSharp) Method

Encrypt() public method

Encrypts the DecryptedTokenData using the EncryptionAlgorithm and places the result in Password
public Encrypt ( X509Certificate2 certificate, byte senderNonce, string securityPolicyUri ) : void
certificate System.Security.Cryptography.X509Certificates.X509Certificate2
senderNonce byte
securityPolicyUri string
return void
        public override void Encrypt(X509Certificate2 certificate, byte[] senderNonce, string securityPolicyUri)
        {
            // handle no encryption.
            if (String.IsNullOrEmpty(securityPolicyUri) || securityPolicyUri == SecurityPolicies.None)
            {
                m_tokenData = m_decryptedTokenData;
                m_encryptionAlgorithm = String.Empty;
                return;
            }

            byte[] dataToEncrypt = Utils.Append(m_decryptedTokenData, senderNonce);

            EncryptedData encryptedData = SecurityPolicies.Encrypt(
                certificate,
                securityPolicyUri,
                dataToEncrypt);
                        
            m_tokenData = encryptedData.Data;
            m_encryptionAlgorithm = encryptedData.Algorithm;
        }