C# Class Dse.Auth.Sspi.Contexts.Context

Represents a security context and provides common functionality required for all security contexts.
This class is abstract and has a protected constructor and Initialize method. The exact initialization implementation is provided by a subclasses, which may perform initialization in a variety of manners.
Inheritance: IDisposable
Datei anzeigen Open project: datastax/csharp-driver-dse

Public Methods

Method Description
Decrypt ( byte input ) : byte[]

Decrypts a previously encrypted message.

The expected format of the buffer is as follows: - 2 bytes, an unsigned big-endian integer indicating the length of the trailer buffer size - 4 bytes, an unsigned big-endian integer indicating the length of the message buffer size. - 2 bytes, an unsigned big-endian integer indicating the length of the encryption padding buffer size. - The trailer buffer - The message buffer - The padding buffer.

Dispose ( ) : void

Releases all resources associated with the context.

Encrypt ( byte input ) : byte[]

Encrypts the byte array using the context's session key.

The structure of the returned data is as follows: - 2 bytes, an unsigned big-endian integer indicating the length of the trailer buffer size - 4 bytes, an unsigned big-endian integer indicating the length of the message buffer size. - 2 bytes, an unsigned big-endian integer indicating the length of the encryption padding buffer size. - The trailer buffer - The message buffer - The padding buffer.

MakeSignature ( byte message ) : byte[]

Signs the message using the context's session key.

The structure of the returned buffer is as follows: - 4 bytes, unsigned big-endian integer indicating the length of the plaintext message - 2 bytes, unsigned big-endian integer indicating the length of the signture - The plaintext message - The message's signature.

VerifySignature ( byte signedMessage, byte &origMessage ) : bool

Verifies the signature of a signed message

The expected structure of the signed message buffer is as follows: - 4 bytes, unsigned integer in big endian format indicating the length of the plaintext message - 2 bytes, unsigned integer in big endian format indicating the length of the signture - The plaintext message - The message's signature.

Protected Methods

Method Description
Context ( Credential cred ) : System

Performs basic initialization of a new instance of the Context class. Initialization is not complete until the ContextHandle property has been set and the Initialize method has been called.

Dispose ( bool disposing ) : void

Releases resources associated with the context.

Initialize ( System.DateTime expiry ) : void

Marks the context as having completed the initialization process, ie, exchanging of authentication tokens.

Private Methods

Method Description
CheckLifecycle ( ) : void

Verifies that the object's lifecycle (initialization / disposition) state is suitable for using the object.

QueryBufferSizes ( ) : SecPkgContext_Sizes

Queries the security package's expections regarding message/token/signature/padding buffer sizes.

QueryContextString ( ContextQueryAttrib attrib ) : string

Queries a string-valued context attribute by the named attribute.

Method Details

Context() protected method

Performs basic initialization of a new instance of the Context class. Initialization is not complete until the ContextHandle property has been set and the Initialize method has been called.
protected Context ( Credential cred ) : System
cred Dse.Auth.Sspi.Credentials.Credential
return System

Decrypt() public method

Decrypts a previously encrypted message.
The expected format of the buffer is as follows: - 2 bytes, an unsigned big-endian integer indicating the length of the trailer buffer size - 4 bytes, an unsigned big-endian integer indicating the length of the message buffer size. - 2 bytes, an unsigned big-endian integer indicating the length of the encryption padding buffer size. - The trailer buffer - The message buffer - The padding buffer.
public Decrypt ( byte input ) : byte[]
input byte The packed and encrypted data.
return byte[]

Dispose() public method

Releases all resources associated with the context.
public Dispose ( ) : void
return void

Dispose() protected method

Releases resources associated with the context.
protected Dispose ( bool disposing ) : void
disposing bool If true, release managed resources, else release only unmanaged resources.
return void

Encrypt() public method

Encrypts the byte array using the context's session key.
The structure of the returned data is as follows: - 2 bytes, an unsigned big-endian integer indicating the length of the trailer buffer size - 4 bytes, an unsigned big-endian integer indicating the length of the message buffer size. - 2 bytes, an unsigned big-endian integer indicating the length of the encryption padding buffer size. - The trailer buffer - The message buffer - The padding buffer.
public Encrypt ( byte input ) : byte[]
input byte The raw message to encrypt.
return byte[]

Initialize() protected method

Marks the context as having completed the initialization process, ie, exchanging of authentication tokens.
protected Initialize ( System.DateTime expiry ) : void
expiry System.DateTime The date and time that the context will expire.
return void

MakeSignature() public method

Signs the message using the context's session key.
The structure of the returned buffer is as follows: - 4 bytes, unsigned big-endian integer indicating the length of the plaintext message - 2 bytes, unsigned big-endian integer indicating the length of the signture - The plaintext message - The message's signature.
public MakeSignature ( byte message ) : byte[]
message byte
return byte[]

VerifySignature() public method

Verifies the signature of a signed message
The expected structure of the signed message buffer is as follows: - 4 bytes, unsigned integer in big endian format indicating the length of the plaintext message - 2 bytes, unsigned integer in big endian format indicating the length of the signture - The plaintext message - The message's signature.
public VerifySignature ( byte signedMessage, byte &origMessage ) : bool
signedMessage byte The packed signed message.
origMessage byte The extracted original message.
return bool