Discuss this help topic in SecureBlackbox Forum

TElPGPSecretKey.Generate

TElPGPSecretKey     


Filter: C#  VB.NET  Pascal  C++  PHP  Java  


Generates new key and binds the user to it.

Declaration

[C#]
    void Generate(string Password, int KeyBits, int KeyAlgorithm, int SubkeyBits, int SubkeyAlgorithm, string UserName, int Expires);
    void Generate(string Password, int KeyBits, int KeyAlgorithm, string UserName, bool UseOldStyle, int Expires);
    void Generate(string Password, int Bits, int Algorithm, bool UseOldFormat, int Expires);

[VB.NET]
    Sub Generate(ByVal Password As String, ByVal KeyBits As Integer, ByVal KeyAlgorithm As Integer, ByVal SubkeyBits As Integer, ByVal SubkeyAlgorithm As Integer, ByVal UserName As String, ByVal Expires As Integer)
    Sub Generate(ByVal Password As String, ByVal KeyBits As Integer, ByVal KeyAlgorithm As Integer, ByVal UserName As String, ByVal UseOldStyle As Boolean, ByVal Expires As Integer)
    Sub Generate(ByVal Password As String, ByVal Bits As Integer, ByVal Algorithm As Integer, ByVal UseOldFormat As Boolean, ByVal Expires As Integer)

[Pascal]
    procedure Generate(const Password : string; KeyBits : integer; KeyAlgorithm : TSBPGPPublicKeyAlgorithm; const UserName : string; UseOldStyle : boolean = True; Expires : integer = 0);
    procedure Generate(const Password : string; KeyBits : integer; KeyAlgorithm : TSBPGPPublicKeyAlgorithm; SubkeyBits : integer; SubkeyAlgorithm : TSBPGPPublicKeyAlgorithm; const UserName : string; Expires : integer = 0);

[C++]
    void Generate(const std::string &Password, int32_t KeyBits, int32_t KeyAlgorithm, int32_t SubkeyBits, int32_t SubkeyAlgorithm, const std::string &UserName, int32_t Expires);
    void Generate(const std::string &Password, int32_t KeyBits, int32_t KeyAlgorithm, const std::string &UserName, bool UseOldStyle, int32_t Expires);

[PHP]
    void Generate(string $Password, integer $KeyBits, integer $KeyAlgorithm, integer $SubkeyBits, integer $SubkeyAlgorithm, string $UserName, integer $Expires)
    void Generate(string $Password, integer $KeyBits, integer $KeyAlgorithm, string $UserName, bool $UseOldStyle, integer $Expires)
    void Generate(string $Password, integer $Bits, integer $Algorithm, bool $UseOldFormat, integer $Expires)

[Java]
    void generate(String Password, int KeyBits, int KeyAlgorithm, String UserName, boolean UseOldStyle, int Expires);
    void generate(String Password, int KeyBits, int KeyAlgorithm, int SubkeyBits, int SubkeyAlgorithm, String UserName, int Expires);

Parameters

  • Password - password for the newly created key.
  • KeyBits - key length in bits.
  • KeyAlgorithm - the public key algorithm on which the key is based.
  • UseOldStyle - specifies if key of old format must be generated for compatibility with earlier PGP versions
  • Expires - number of days after which the key will expire. If 0 - the key will never expire.
  • SubkeyBits - subkey length in bits.
  • SubkeyAlgorithm - the public key algorithm on which the subkey is based.
  • UserName - the user to be bound to the key
  • Bits - ...
  • Algorithm - ...
  • UseOldFormat - ...

Public key algorithm values

Description

    Use this method to generate new secret key and bind the user to it at once. You can generate the key together with subkey.

    The widely used OpenPGP keypair format today is a <main key, subkey> bundle with a sign-only main key and encrypt-only subkey. PGP 2.6.x used an older key format that only consisted of a single encrypt-and-sign RSA key. TElPGPSecretKey publishes two overloaded Generate() methods, the first one for generating older keys and the second for generating modern keys. If you have no special requirements for key format (either old or new), choose the new one.

Discuss this help topic in SecureBlackbox Forum