Discuss this help topic in SecureBlackbox Forum

Create an instance of the asymmetric keypair

Asymmetric keys are mainly used in two cases: to encrypt symmetric session keys within a higher-level key agreement procedure, or to digitally sign data. In modern environments high-level envelopes over cryptographic keys are typically used, such as X.509 certificates or PGP keys. However, sometimes there's a need in low-level cryptographic keys without complicated schemes and large PKI structures such as certificates. This article explains how to generate a brand new RSA keypair.

  1. Create TElRSAKeyMaterial object (SBPublicKeyCrypto namespace): TElRSAKeyMaterial km = new TElRSAKeyMaterial();
  2. Call its Generate() method, passing the desired length of the key as the parameter: km.Generate(2048);
  3. Save the private and public keys separately: km.SavePublic(publicStream);

That's it. If you need to use the created key later, you can use LoadPublic() and LoadSecret() methods of the key material object to load the required piece of the key back into the object.

SecureBlackbox uses specific classes to manage different types of asymmetric keys:

How To articles related to low-level cryptography

Discuss this help topic in SecureBlackbox Forum