C# 클래스 Opc.Ua.Bindings.TcpChannel

Manages the server side of a UA TCP channel.
파일 보기 프로젝트 열기: OPCFoundation/UA-.NETStandardLibrary

Private Properties

프로퍼티 타입 설명
GetMaxSenderCertificateSize int
ReadAsymmetricMessageHeader void
ReadSymmetricMessage ArraySegment
RsaPkcs15_GetSignatureLength int
RsaPkcs15_Sign byte[]
RsaPkcs15_Verify bool
Rsa_Decrypt ArraySegment
Rsa_Encrypt ArraySegment
SymmetricDecrypt void
SymmetricEncrypt void
SymmetricSign byte[]
SymmetricVerify bool

보호된 메소드들

메소드 설명
ActivateToken ( TcpChannelToken token ) : void

Activates a new token.

CalculateSymmetricKeySizes ( ) : void

Calculates the symmetric key sizes based on the current security policy.

CompareCertificates ( X509Certificate2 expected, X509Certificate2 actual, bool allowNull ) : void

Compares two certificates.

ComputeKeys ( TcpChannelToken token ) : void

Computes the keys for a token.

CreateNonce ( ) : byte[]

Creates a new nonce.

CreateToken ( ) : TcpChannelToken

Creates a new token.

Decrypt ( ArraySegment dataToDecrypt, ArraySegment headerToCopy, X509Certificate2 receiverCertificate ) : ArraySegment

Decrypts the buffer using asymmetric encryption.

Start and count specify the block of data to be decrypted. The header specifies unencrypted data that must be copied to the output.

Decrypt ( TcpChannelToken token, ArraySegment dataToDecrypt, bool useClientKeys ) : void

Decrypts the data in a buffer using symmetric encryption.

DiscardTokens ( ) : void

Discards the tokens.

Encrypt ( ArraySegment dataToEncrypt, ArraySegment headerToCopy, X509Certificate2 receiverCertificate ) : ArraySegment

Encrypts the buffer using asymmetric encryption.

Start and count specify the block of data to be encrypted. The caller must ensure that count is a multiple of the input block size for the current cipher. The header specifies unencrypted data that must be copied to the output.

Encrypt ( TcpChannelToken token, ArraySegment dataToEncrypt, bool useClientKeys ) : void

Decrypts the data in a buffer using symmetric encryption.

GetAsymmetricHeaderSize ( string securityPolicyUri, X509Certificate2 senderCertificate ) : int

Calculates the size of the asymmetric security header.

GetAsymmetricHeaderSize ( string securityPolicyUri, X509Certificate2 senderCertificate, int senderCertificateSize ) : int
GetAsymmetricSignatureSize ( X509Certificate2 senderCertificate ) : int

Calculates the size of the footer with an asymmetric signature.

GetCipherTextBlockSize ( X509Certificate2 receiverCertificate ) : int

Returns the cipher text block size for key in the specified certificate.

GetNonceLength ( ) : uint

Returns the length of the symmetric encryption key.

GetPlainTextBlockSize ( X509Certificate2 receiverCertificate ) : int

Returns the plain text block size for key in the specified certificate.

GetThumbprintBytes ( string thumbprint ) : byte[]

Returns the thumbprint as a uppercase string.

GetThumbprintString ( byte thumbprint ) : string

Returns the thumbprint as a uppercase string.

ReadAsymmetricMessage ( ArraySegment buffer, X509Certificate2 receiverCertificate, uint &channelId, X509Certificate2 &senderCertificate, uint &requestId, uint &sequenceNumber ) : ArraySegment

Processes an OpenSecureChannel request message.

ReviseSecurityMode ( bool firstCall, MessageSecurityMode requestedMode ) : void

Checks if it is possible to revise the security mode.

Rsa_GetCipherTextBlockSize ( X509Certificate2 encryptingCertificate, bool useOaep ) : int

Return the ciphertext block size for RSA OAEP encryption.

Rsa_GetPlainTextBlockSize ( X509Certificate2 encryptingCertificate, bool useOaep ) : int

Return the plaintext block size for RSA OAEP encryption.

SetEndpointUrl ( string endpointUrl ) : bool

Sets to endpoint according to the endpoint url.

SetRenewedToken ( TcpChannelToken token ) : void

Sets the renewed token

Sign ( ArraySegment dataToSign, X509Certificate2 senderCertificate ) : byte[]

Adds an asymmetric signature to the end of the buffer.

Start and count specify the block of data to be signed. The padding and signature must be written to the stream wrapped by the encoder.

Sign ( TcpChannelToken token, ArraySegment dataToSign, bool useClientKeys ) : byte[]

Returns the symmetric signature for the data.

ValidateNonce ( byte nonce ) : bool

Validates the nonce.

Verify ( ArraySegment dataToVerify, byte signature, X509Certificate2 senderCertificate ) : bool

Verifies an asymmetric signature at the end of the buffer.

Start and count specify the block of data including the signature and padding. The current security policy uri and sender certificate specify the size of the signature. This call also verifies that the padding is correct.

Verify ( TcpChannelToken token, byte signature, ArraySegment dataToVerify, bool useClientKeys ) : bool

Returns the symmetric signature for the data.

WriteAsymmetricMessage ( uint messageType, uint requestId, X509Certificate2 senderCertificate, X509Certificate2 receiverCertificate, ArraySegment messageBody ) : BufferCollection

Sends a OpenSecureChannel response.

WriteAsymmetricMessageHeader ( BinaryEncoder encoder, uint messageType, uint secureChannelId, string securityPolicyUri, X509Certificate2 senderCertificate, X509Certificate2 receiverCertificate ) : void

Writes the asymmetric security header to the buffer.

WriteSymmetricMessage ( uint messageType, uint requestId, TcpChannelToken token, object messageBody, bool isRequest, bool &limitsExceeded ) : BufferCollection

Secures the message using the security token.

비공개 메소드들

메소드 설명
GetMaxSenderCertificateSize ( X509Certificate2 senderCertificate, string securityPolicyUri ) : int
ReadAsymmetricMessageHeader ( BinaryDecoder decoder, X509Certificate2 receiverCertificate, uint &secureChannelId, X509Certificate2 &senderCertificate, string &securityPolicyUri ) : void
ReadSymmetricMessage ( ArraySegment buffer, bool isRequest, TcpChannelToken &token, uint &requestId, uint &sequenceNumber ) : ArraySegment
RsaPkcs15_GetSignatureLength ( X509Certificate2 signingCertificate ) : int

Returns the length of a RSA PKCS#1 v1.5 signature.

RsaPkcs15_Sign ( ArraySegment dataToSign, X509Certificate2 signingCertificate, HashAlgorithmName algorithm ) : byte[]

Creates an RSA PKCS#1 v1.5 signature of a hash algorithm for the stream.

RsaPkcs15_Verify ( ArraySegment dataToVerify, byte signature, X509Certificate2 signingCertificate, HashAlgorithmName algorithm ) : bool

Verifies an RSA PKCS#1 v1.5 signature of a hash algorithm for the stream.

Rsa_Decrypt ( ArraySegment dataToDecrypt, ArraySegment headerToCopy, X509Certificate2 encryptingCertificate, bool useOaep ) : ArraySegment

Decrypts the message using RSA PKCS#1 v1.5 encryption.

Rsa_Encrypt ( ArraySegment dataToEncrypt, ArraySegment headerToCopy, X509Certificate2 encryptingCertificate, bool useOaep ) : ArraySegment

Encrypts the message using RSA PKCS#1 v1.5 encryption.

SymmetricDecrypt ( TcpChannelToken token, ArraySegment dataToDecrypt, bool useClientKeys ) : void

Decrypts a message using a symmetric algorithm.

SymmetricEncrypt ( TcpChannelToken token, ArraySegment dataToEncrypt, bool useClientKeys ) : void

Encrypts a message using a symmetric algorithm.

SymmetricSign ( TcpChannelToken token, ArraySegment dataToSign, bool useClientKeys ) : byte[]

Signs the message using SHA1 HMAC

SymmetricVerify ( TcpChannelToken token, byte signature, ArraySegment dataToVerify, bool useClientKeys ) : bool

Verifies a HMAC for a message.

메소드 상세

ActivateToken() 보호된 메소드

Activates a new token.
protected ActivateToken ( TcpChannelToken token ) : void
token TcpChannelToken
리턴 void

CalculateSymmetricKeySizes() 보호된 메소드

Calculates the symmetric key sizes based on the current security policy.
protected CalculateSymmetricKeySizes ( ) : void
리턴 void

CompareCertificates() 보호된 정적인 메소드

Compares two certificates.
protected static CompareCertificates ( X509Certificate2 expected, X509Certificate2 actual, bool allowNull ) : void
expected System.Security.Cryptography.X509Certificates.X509Certificate2
actual System.Security.Cryptography.X509Certificates.X509Certificate2
allowNull bool
리턴 void

ComputeKeys() 보호된 메소드

Computes the keys for a token.
protected ComputeKeys ( TcpChannelToken token ) : void
token TcpChannelToken
리턴 void

CreateNonce() 보호된 메소드

Creates a new nonce.
protected CreateNonce ( ) : byte[]
리턴 byte[]

CreateToken() 보호된 메소드

Creates a new token.
protected CreateToken ( ) : TcpChannelToken
리턴 TcpChannelToken

Decrypt() 보호된 메소드

Decrypts the buffer using asymmetric encryption.
Start and count specify the block of data to be decrypted. The header specifies unencrypted data that must be copied to the output.
protected Decrypt ( ArraySegment dataToDecrypt, ArraySegment headerToCopy, X509Certificate2 receiverCertificate ) : ArraySegment
dataToDecrypt ArraySegment
headerToCopy ArraySegment
receiverCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 ArraySegment

Decrypt() 보호된 메소드

Decrypts the data in a buffer using symmetric encryption.
protected Decrypt ( TcpChannelToken token, ArraySegment dataToDecrypt, bool useClientKeys ) : void
token TcpChannelToken
dataToDecrypt ArraySegment
useClientKeys bool
리턴 void

DiscardTokens() 보호된 메소드

Discards the tokens.
protected DiscardTokens ( ) : void
리턴 void

Encrypt() 보호된 메소드

Encrypts the buffer using asymmetric encryption.
Start and count specify the block of data to be encrypted. The caller must ensure that count is a multiple of the input block size for the current cipher. The header specifies unencrypted data that must be copied to the output.
protected Encrypt ( ArraySegment dataToEncrypt, ArraySegment headerToCopy, X509Certificate2 receiverCertificate ) : ArraySegment
dataToEncrypt ArraySegment
headerToCopy ArraySegment
receiverCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 ArraySegment

Encrypt() 보호된 메소드

Decrypts the data in a buffer using symmetric encryption.
protected Encrypt ( TcpChannelToken token, ArraySegment dataToEncrypt, bool useClientKeys ) : void
token TcpChannelToken
dataToEncrypt ArraySegment
useClientKeys bool
리턴 void

GetAsymmetricHeaderSize() 보호된 메소드

Calculates the size of the asymmetric security header.
protected GetAsymmetricHeaderSize ( string securityPolicyUri, X509Certificate2 senderCertificate ) : int
securityPolicyUri string
senderCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 int

GetAsymmetricHeaderSize() 보호된 메소드

protected GetAsymmetricHeaderSize ( string securityPolicyUri, X509Certificate2 senderCertificate, int senderCertificateSize ) : int
securityPolicyUri string
senderCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
senderCertificateSize int
리턴 int

GetAsymmetricSignatureSize() 보호된 메소드

Calculates the size of the footer with an asymmetric signature.
protected GetAsymmetricSignatureSize ( X509Certificate2 senderCertificate ) : int
senderCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 int

GetCipherTextBlockSize() 보호된 메소드

Returns the cipher text block size for key in the specified certificate.
protected GetCipherTextBlockSize ( X509Certificate2 receiverCertificate ) : int
receiverCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 int

GetNonceLength() 보호된 메소드

Returns the length of the symmetric encryption key.
protected GetNonceLength ( ) : uint
리턴 uint

GetPlainTextBlockSize() 보호된 메소드

Returns the plain text block size for key in the specified certificate.
protected GetPlainTextBlockSize ( X509Certificate2 receiverCertificate ) : int
receiverCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 int

GetThumbprintBytes() 보호된 정적인 메소드

Returns the thumbprint as a uppercase string.
protected static GetThumbprintBytes ( string thumbprint ) : byte[]
thumbprint string
리턴 byte[]

GetThumbprintString() 보호된 정적인 메소드

Returns the thumbprint as a uppercase string.
protected static GetThumbprintString ( byte thumbprint ) : string
thumbprint byte
리턴 string

ReadAsymmetricMessage() 보호된 메소드

Processes an OpenSecureChannel request message.
protected ReadAsymmetricMessage ( ArraySegment buffer, X509Certificate2 receiverCertificate, uint &channelId, X509Certificate2 &senderCertificate, uint &requestId, uint &sequenceNumber ) : ArraySegment
buffer ArraySegment
receiverCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
channelId uint
senderCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
requestId uint
sequenceNumber uint
리턴 ArraySegment

ReviseSecurityMode() 보호된 메소드

Checks if it is possible to revise the security mode.
protected ReviseSecurityMode ( bool firstCall, MessageSecurityMode requestedMode ) : void
firstCall bool
requestedMode MessageSecurityMode
리턴 void

Rsa_GetCipherTextBlockSize() 보호된 정적인 메소드

Return the ciphertext block size for RSA OAEP encryption.
protected static Rsa_GetCipherTextBlockSize ( X509Certificate2 encryptingCertificate, bool useOaep ) : int
encryptingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
useOaep bool
리턴 int

Rsa_GetPlainTextBlockSize() 보호된 정적인 메소드

Return the plaintext block size for RSA OAEP encryption.
protected static Rsa_GetPlainTextBlockSize ( X509Certificate2 encryptingCertificate, bool useOaep ) : int
encryptingCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
useOaep bool
리턴 int

SetEndpointUrl() 보호된 메소드

Sets to endpoint according to the endpoint url.
protected SetEndpointUrl ( string endpointUrl ) : bool
endpointUrl string
리턴 bool

SetRenewedToken() 보호된 메소드

Sets the renewed token
protected SetRenewedToken ( TcpChannelToken token ) : void
token TcpChannelToken
리턴 void

Sign() 보호된 메소드

Adds an asymmetric signature to the end of the buffer.
Start and count specify the block of data to be signed. The padding and signature must be written to the stream wrapped by the encoder.
protected Sign ( ArraySegment dataToSign, X509Certificate2 senderCertificate ) : byte[]
dataToSign ArraySegment
senderCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 byte[]

Sign() 보호된 메소드

Returns the symmetric signature for the data.
protected Sign ( TcpChannelToken token, ArraySegment dataToSign, bool useClientKeys ) : byte[]
token TcpChannelToken
dataToSign ArraySegment
useClientKeys bool
리턴 byte[]

ValidateNonce() 보호된 메소드

Validates the nonce.
protected ValidateNonce ( byte nonce ) : bool
nonce byte
리턴 bool

Verify() 보호된 메소드

Verifies an asymmetric signature at the end of the buffer.
Start and count specify the block of data including the signature and padding. The current security policy uri and sender certificate specify the size of the signature. This call also verifies that the padding is correct.
protected Verify ( ArraySegment dataToVerify, byte signature, X509Certificate2 senderCertificate ) : bool
dataToVerify ArraySegment
signature byte
senderCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 bool

Verify() 보호된 메소드

Returns the symmetric signature for the data.
protected Verify ( TcpChannelToken token, byte signature, ArraySegment dataToVerify, bool useClientKeys ) : bool
token TcpChannelToken
signature byte
dataToVerify ArraySegment
useClientKeys bool
리턴 bool

WriteAsymmetricMessage() 보호된 메소드

Sends a OpenSecureChannel response.
protected WriteAsymmetricMessage ( uint messageType, uint requestId, X509Certificate2 senderCertificate, X509Certificate2 receiverCertificate, ArraySegment messageBody ) : BufferCollection
messageType uint
requestId uint
senderCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
receiverCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
messageBody ArraySegment
리턴 BufferCollection

WriteAsymmetricMessageHeader() 보호된 메소드

Writes the asymmetric security header to the buffer.
protected WriteAsymmetricMessageHeader ( BinaryEncoder encoder, uint messageType, uint secureChannelId, string securityPolicyUri, X509Certificate2 senderCertificate, X509Certificate2 receiverCertificate ) : void
encoder BinaryEncoder
messageType uint
secureChannelId uint
securityPolicyUri string
senderCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
receiverCertificate System.Security.Cryptography.X509Certificates.X509Certificate2
리턴 void

WriteSymmetricMessage() 보호된 메소드

Secures the message using the security token.
protected WriteSymmetricMessage ( uint messageType, uint requestId, TcpChannelToken token, object messageBody, bool isRequest, bool &limitsExceeded ) : BufferCollection
messageType uint
requestId uint
token TcpChannelToken
messageBody object
isRequest bool
limitsExceeded bool
리턴 BufferCollection