Click or drag to resize

RsaKeyHashCode(StringBuilder) Method

Compute the hash code of an "internal" RSA public or private key string.

Namespace: CryptoSysPKI
Assembly: diCrSysPKINet (in diCrSysPKINet.dll) Version: 23.0.0.25611 (23.0.0.0)
Syntax
public static int KeyHashCode(
	StringBuilder sbKeyString
)

Parameters

sbKeyString  StringBuilder
Internal key string

Return Value

Int32
A 32-bit hash code for the key, or zero on error.
Example
C#
// Use Rsa.KeyHashCode for matching public and private keys
StringBuilder sbPrivateKey = Rsa.ReadPrivateKey("lamps-alice.p8", "");  // Unencrypted .p8 file
StringBuilder sbPublicKey = Rsa.ReadPublicKey("lamps-alice.cer");  // Matching X.509 certificate
Console.WriteLine("Private Key: Rsa.KeyHashCode={0,8:X}", Rsa.KeyHashCode(sbPrivateKey.ToString()));
Console.WriteLine("Public Key:  Rsa.KeyHashCode={0,8:X}", Rsa.KeyHashCode(sbPublicKey.ToString()));
// Private Key: Rsa.KeyHashCode=CA0B84DA
// Public Key:  Rsa.KeyHashCode=CA0B84DA
See Also