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
Afficher le fichier Open project: datastax/csharp-driver-dse

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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

Méthode 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 méthode

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
Résultat System

Decrypt() public méthode

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.
Résultat byte[]

Dispose() public méthode

Releases all resources associated with the context.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

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

Encrypt() public méthode

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.
Résultat byte[]

Initialize() protected méthode

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.
Résultat void

MakeSignature() public méthode

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
Résultat byte[]

VerifySignature() public méthode

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.
Résultat bool