C# Class Demo.RSACryptoServiceProviderExtension

Extension method for initializing a RSACryptoServiceProvider from PEM data string.
Datei anzeigen Open project: PingPlusPlus/pingpp-csharp Class Usage Examples

Public Methods

Method Description
LoadPrivateKeyDER ( this provider, byte DERData ) : void

Extension method which initializes an RSACryptoServiceProvider from a DER private key blob.

LoadPrivateKeyPEM ( this provider, string sPEM ) : void

Extension method which initializes an RSACryptoServiceProvider from a PEM private key string.

LoadPublicKeyDER ( this provider, byte DERData ) : void

Extension method which initializes an RSACryptoServiceProvider from a DER public key blob.

LoadPublicKeyPEM ( this provider, string sPEM ) : void

Extension method which initializes an RSACryptoServiceProvider from a PEM public key string.

Private Methods

Method Description
CryptAcquireContext ( IntPtr &hProv, string pszContainer, string pszProvider, CRYPT_PROVIDER_TYPE dwProvType, CRYPT_ACQUIRE_CONTEXT_FLAGS dwFlags ) : bool
CryptDecodeObject ( CRYPT_ENCODING_FLAGS dwCertEncodingType, IntPtr lpszStructType, byte pbEncoded, UInt32 cbEncoded, CRYPT_DECODE_FLAGS flags, [ pvStructInfo, UInt32 &cbStructInfo ) : bool
CryptDecodeObjectEx ( CRYPT_ENCODING_FLAGS dwCertEncodingType, IntPtr lpszStructType, byte pbEncoded, UInt32 cbEncoded, CRYPT_DECODE_FLAGS dwFlags, IntPtr pDecodePara, byte &pvStructInfo, UInt32 &pcbStructInfo ) : bool
CryptDestroyKey ( IntPtr hKey ) : bool
CryptImportKey ( IntPtr hProv, byte pbKeyData, UInt32 dwDataLen, IntPtr hPubKey, UInt32 dwFlags, IntPtr &hKey ) : bool
CryptReleaseContext ( IntPtr hProv, Int32 dwFlags ) : bool
CryptStringToBinary ( string sPEM, UInt32 sPEMLength, CRYPT_STRING_FLAGS dwFlags, [ pbBinary, UInt32 &pcbBinary, UInt32 &pdwSkip, UInt32 &pdwFlags ) : bool
GetDERFromPEM ( string sPEM ) : byte[]

Extracts the binary data from a PEM file.

GetPrivateKeyDER ( byte DERData ) : byte[]

Converts DER binary format to a CAPI CRYPT_PRIVATE_KEY_INFO structure.

GetPublicKeyBlobFromRSA ( byte RSAData ) : byte[]

Returns a public key blob from an RSA public key.

GetRSAFromDER ( byte DERData ) : byte[]

Converts DER binary format to a CAPI CERT_PUBLIC_KEY_INFO structure containing an RSA key.

Method Details

LoadPrivateKeyDER() public static method

Extension method which initializes an RSACryptoServiceProvider from a DER private key blob.
public static LoadPrivateKeyDER ( this provider, byte DERData ) : void
provider this
DERData byte
return void

LoadPrivateKeyPEM() public static method

Extension method which initializes an RSACryptoServiceProvider from a PEM private key string.
public static LoadPrivateKeyPEM ( this provider, string sPEM ) : void
provider this
sPEM string
return void

LoadPublicKeyDER() public static method

Extension method which initializes an RSACryptoServiceProvider from a DER public key blob.
public static LoadPublicKeyDER ( this provider, byte DERData ) : void
provider this
DERData byte
return void

LoadPublicKeyPEM() public static method

Extension method which initializes an RSACryptoServiceProvider from a PEM public key string.
public static LoadPublicKeyPEM ( this provider, string sPEM ) : void
provider this
sPEM string
return void