C# Class Tpm2Lib.SymmCipher

A helper class for doing symmetric cryptography based on TPM structure definitions.
Inheritance: IDisposable
Show file Open project: Microsoft/TSS.MSR Class Usage Examples

Public Properties

Property Type Description
LimitedSupport bool

Public Methods

Method Description
Create ( SymDefObject symDef = null, byte keyData = null, byte iv = null ) : SymmCipher

Create a new SymmCipher object with a random key based on the alg and mode supplied.

CreateFromPublicParms ( IPublicParmsUnion parms ) : SymmCipher
Decrypt ( SymDefObject symDef, byte key, byte iv, byte dataToDecrypt ) : byte[]
Decrypt ( byte data, byte iv = null ) : byte[]
Dispose ( ) : void
Encrypt ( SymDefObject symDef, byte key, byte iv, byte dataToEncrypt ) : byte[]
Encrypt ( byte data, byte iv = null ) : byte[]

Performs the TPM-defined CFB encrypt using the associated algorithm. This routine assumes that the integrity value has been prepended.

GetBlockSize ( SymDefObject symDef ) : int
GetCipherMode ( TpmAlgId cipherMode ) : CipherMode
SensitiveFromDuplicateBlob ( TpmPrivate exportedPrivate, SymDefObject encAlg, byte encKey, TpmAlgId nameAlg, byte name ) : Sensitive

De-envelope inner-wrapped duplication blob. TODO: Move this to TpmPublic and make it fully general

Private Methods

Method Description
SymmCipher ( BCryptKey key, byte keyData, byte iv ) : System
SymmCipher ( SymmetricAlgorithm alg ) : System

Method Details

Create() public static method

Create a new SymmCipher object with a random key based on the alg and mode supplied.
public static Create ( SymDefObject symDef = null, byte keyData = null, byte iv = null ) : SymmCipher
symDef SymDefObject
keyData byte
iv byte
return SymmCipher

CreateFromPublicParms() public static method

public static CreateFromPublicParms ( IPublicParmsUnion parms ) : SymmCipher
parms IPublicParmsUnion
return SymmCipher

Decrypt() public static method

public static Decrypt ( SymDefObject symDef, byte key, byte iv, byte dataToDecrypt ) : byte[]
symDef SymDefObject
key byte
iv byte
dataToDecrypt byte
return byte[]

Decrypt() public method

public Decrypt ( byte data, byte iv = null ) : byte[]
data byte
iv byte
return byte[]

Dispose() public method

public Dispose ( ) : void
return void

Encrypt() public static method

public static Encrypt ( SymDefObject symDef, byte key, byte iv, byte dataToEncrypt ) : byte[]
symDef SymDefObject
key byte
iv byte
dataToEncrypt byte
return byte[]

Encrypt() public method

Performs the TPM-defined CFB encrypt using the associated algorithm. This routine assumes that the integrity value has been prepended.
public Encrypt ( byte data, byte iv = null ) : byte[]
data byte
iv byte
return byte[]

GetBlockSize() public static method

public static GetBlockSize ( SymDefObject symDef ) : int
symDef SymDefObject
return int

GetCipherMode() public static method

public static GetCipherMode ( TpmAlgId cipherMode ) : CipherMode
cipherMode TpmAlgId
return CipherMode

SensitiveFromDuplicateBlob() public static method

De-envelope inner-wrapped duplication blob. TODO: Move this to TpmPublic and make it fully general
public static SensitiveFromDuplicateBlob ( TpmPrivate exportedPrivate, SymDefObject encAlg, byte encKey, TpmAlgId nameAlg, byte name ) : Sensitive
exportedPrivate TpmPrivate
encAlg SymDefObject
encKey byte
nameAlg TpmAlgId
name byte
return Sensitive

Property Details

LimitedSupport public property

public bool LimitedSupport
return bool