Méthode | Description | |
---|---|---|
CryptAcquireContext ( System.Security.Cryptography.SafeProvHandle &psafeProvHandle, string pszContainer, string pszProvider, int dwProvType, uint dwFlags ) : bool |
Acquire a handle to a crypto service provider and optionally a key container
|
|
CryptDestroyHash ( |
Destroy a crypto hash.
|
|
CryptDestroyKey ( |
Destroy a crypto key.
|
|
CryptReleaseContext ( |
Destroy a crypto provider.
|
|
GetProviderParameter ( System.Security.Cryptography.SafeProvHandle safeProvHandle, int keyNumber, int keyParam ) : object |
This method queries the key container and get some of it's properties. Those properties should never cause UI to display.
|
|
NameOrOidToHashAlgId ( String nameOrOid ) : int |
Helper for signing and verifications that accept a string to specify a hashing algorithm.
|
|
ObjToHashAlgId ( Object hashAlg ) : int |
Helper for signing and verifications that accept a string/Type/HashAlgorithm to specify a hashing algorithm.
|
|
OpenCSP ( |
OpenCSP performs the core work of opening and creating CSPs and containers in CSPs
|
|
SignValue ( System.Security.Cryptography.SafeProvHandle hProv, SafeKeyHandle hKey, int keyNumber, int calgKey, int calgHash, byte hash ) : byte[] |
Helper for RSACryptoServiceProvider.SignData/SignHash apis.
|
|
UpgradeRSA ( int dwProvType, string wszProvider ) : string |
Check to see if a better CSP than the one requested is available RSA providers are supersets of each other in the following order: 1. MS_ENH_RSA_AES_PROV 2. MS_ENHANCED_PROV 3. MS_DEF_PROV This will return the best provider which is a superset of wszProvider, or NULL if there is no upgrade available on the machine.
|
|
VerifySign ( System.Security.Cryptography.SafeProvHandle hProv, SafeKeyHandle hKey, int calgKey, int calgHash, byte hash, byte signature ) : bool |
Helper for RSACryptoServiceProvider.VerifyData/VerifyHash apis.
|
Méthode | Description | |
---|---|---|
AcquireCryptContext ( System.Security.Cryptography.SafeProvHandle &safeProvHandle, string keyContainer, string providerName, int providerType, uint flags ) : int |
Acquire a handle to a crypto service provider and optionally a key container This function implements the WszCryptAcquireContext_SO_TOLERANT
|
|
AcquireCsp ( |
This method opens the CSP using CRYPT_VERIFYCONTEXT KeyContainer must be null for the flag CRYPT_VERIFYCONTEXT This method asserts if keyContainer is not null
|
|
CreateCSP ( |
Creates a new key container
|
|
CreateHashHandle ( this hProv, byte hash, int calgHash ) : SafeHashHandle |
Create a CAPI-1 hash handle that contains the specified bits as its hash value.
|
|
CreateProvHandle ( |
This method acquires CSP and returns the handle of CSP
|
|
DecryptData ( SafeKeyHandle hKey, byte input, int inputOffset, int inputCount, byte output, int outputOffset, int outputCount ) : int | ||
DecryptKey ( SafeKeyHandle safeKeyHandle, byte encryptedData, int encryptedDataLength, bool fOAEP, byte &decryptedData ) : void | ||
EncryptData ( SafeKeyHandle hKey, byte input, int inputOffset, int inputCount, byte output, int outputOffset, int outputCount, bool isFinal ) : int | ||
EncryptKey ( SafeKeyHandle safeKeyHandle, byte pbKey, int cbKey, bool foep, byte &pbEncryptedKey ) : void | ||
ExponentAsBytes ( uint exponent ) : byte[] |
Helper for converting a UInt32 exponent to bytes.
|
|
ExportKeyBlob ( bool includePrivateParameters, SafeKeyHandle safeKeyHandle ) : byte[] |
Helper for Export CSP
|
|
GenerateKey ( System.Security.Cryptography.SafeProvHandle safeProvHandle, int algID, int flags, uint keySize, SafeKeyHandle &safeKeyHandle ) : int |
Generates the key if provided CSP handle is valid
|
|
GetAlgIdFromOid ( string oid, OidGroup oidGroup ) : int |
Convert an OID into a CAPI-1 CALG ID.
|
|
GetDefaultProvider ( int dwType ) : string |
Find the default provider name to be used in the case that we were not actually passed in a provider name. The main purpose of this code is really to deal with the enhanced/default provider problems given to us by CAPI.
|
|
GetErrorCode ( ) : int |
Wrapper for get last error function
|
|
GetKeyPairHelper ( CspAlgorithmType keyType, |
Helper function to get the key pair
|
|
GetKeyParameter ( SafeKeyHandle safeKeyHandle, int keyParam ) : byte[] |
Method helps get the different key properties
|
|
GetPersistKeyInCsp ( System.Security.Cryptography.SafeProvHandle safeProvHandle ) : bool |
Returns PersistKeyInCsp value
|
|
GetProviderParameterWorker ( System.Security.Cryptography.SafeProvHandle safeProvHandle, byte impType, int &cb, CryptGetProvParam flags ) : int |
This method helps reduce the duplicate code in the GetProviderParameter method
|
|
GetUserKey ( System.Security.Cryptography.SafeProvHandle safeProvHandle, int keySpec, SafeKeyHandle &safeKeyHandle ) : int |
Retrieves the handle for user public / private key pair.
|
|
ImportKeyBlob ( System.Security.Cryptography.SafeProvHandle saveProvHandle, CspProviderFlags flags, bool addNoSaltFlag, byte keyBlob, SafeKeyHandle &safeKeyHandle ) : void |
Helper for Import CSP
|
|
IsFlagBitSet ( uint dwImp, uint flag ) : bool |
This method validates the flag bits set or not. Only works for flags with just one bit set
|
|
MapCspKeyFlags ( int flags ) : int |
Maps CspProviderFlags enumeration into CAPI flags.
|
|
MapCspProviderFlags ( int flags ) : uint |
Maps CspProviderFlags enumeration into CAPI flags
|
|
ObjToHashAlgorithm ( Object hashAlg ) : |
||
ReadReversed ( this br, int count ) : byte[] |
Read in a byte array in reverse order.
|
|
SaveCspParameters ( CspAlgorithmType keyType, |
Helper method to save the CSP parameters.
|
|
SetKeyParameter ( SafeKeyHandle safeKeyHandle, CryptGetKeyParamQueryType keyParam, byte value ) : void |
Set a key property which is based on byte[]
|
|
SetKeyParameter ( SafeKeyHandle safeKeyHandle, CryptGetKeyParamQueryType keyParam, int value ) : void |
Set a key property which is based on int
|
|
SetPersistKeyInCsp ( System.Security.Cryptography.SafeProvHandle safeProvHandle, bool fPersistKeyInCsp ) : void |
Sets the PersistKeyInCsp
|
|
ToKeyBlob ( this rsaParameters, int algId ) : byte[] |
Helper for RsaCryptoServiceProvider.ImportParameters()
|
|
ToPlainTextKeyBlob ( int algId, byte rawKey ) : byte[] |
Helper for RC2CryptoServiceProvider and DESCryptoServiceProvider
|
|
ToRSAParameters ( this cspBlob, bool includePrivateParameters ) : |
Helper for RsaCryptoServiceProvider.ExportParameters()
|
|
ValidateCspFlags ( CspProviderFlags flags ) : void |
Validates the CSP flags are expected
|
|
VerifyValidHandle ( System.Security.Cryptography.SafeHandleZeroOrMinusOneIsInvalid handle ) : void |
This method checks if the handle is invalid then it throws error
|
|
WriteKeyBlobHeader ( int algId, |
||
WriteReversed ( this bw, byte bytes ) : void |
Write out a byte array in reverse order.
|
public static CryptAcquireContext ( System.Security.Cryptography.SafeProvHandle &psafeProvHandle, string pszContainer, string pszProvider, int dwProvType, uint dwFlags ) : bool | ||
psafeProvHandle | System.Security.Cryptography.SafeProvHandle | |
pszContainer | string | |
pszProvider | string | |
dwProvType | int | |
dwFlags | uint | |
Résultat | bool |
public static CryptDestroyHash ( |
||
hHash | ||
Résultat | bool |
public static CryptDestroyKey ( |
||
hKey | ||
Résultat | bool |
public static CryptReleaseContext ( |
||
safeProvHandle | ||
dwFlags | int | |
Résultat | bool |
public static GetProviderParameter ( System.Security.Cryptography.SafeProvHandle safeProvHandle, int keyNumber, int keyParam ) : object | ||
safeProvHandle | System.Security.Cryptography.SafeProvHandle | |
keyNumber | int | |
keyParam | int | |
Résultat | object |
public static NameOrOidToHashAlgId ( String nameOrOid ) : int | ||
nameOrOid | String | |
Résultat | int |
public static ObjToHashAlgId ( Object hashAlg ) : int | ||
hashAlg | Object | |
Résultat | int |
public static OpenCSP ( |
||
cspParameters | ||
flags | uint | |
safeProvHandle | System.Security.Cryptography.SafeProvHandle | |
Résultat | int |
public static SignValue ( System.Security.Cryptography.SafeProvHandle hProv, SafeKeyHandle hKey, int keyNumber, int calgKey, int calgHash, byte hash ) : byte[] | ||
hProv | System.Security.Cryptography.SafeProvHandle | |
hKey | SafeKeyHandle | |
keyNumber | int | |
calgKey | int | |
calgHash | int | |
hash | byte | |
Résultat | byte[] |
public static UpgradeRSA ( int dwProvType, string wszProvider ) : string | ||
dwProvType | int | Provider type |
wszProvider | string | Provider name |
Résultat | string |
public static VerifySign ( System.Security.Cryptography.SafeProvHandle hProv, SafeKeyHandle hKey, int calgKey, int calgHash, byte hash, byte signature ) : bool | ||
hProv | System.Security.Cryptography.SafeProvHandle | |
hKey | SafeKeyHandle | |
calgKey | int | |
calgHash | int | |
hash | byte | |
signature | byte | |
Résultat | bool |