Discuss this help topic in SecureBlackbox Forum

Add a subkey to an OpenPGP key

Creation of a new subkey for a primary key involves several steps. Note that any subkey modification involves signing by the primary key, and thus requires you to know the password for the main key.

  1. First, you need to generate a brand new cryptographic key material for a subkey. This is done with the secret key object’s Generate() method:
    TElPGPSecretSubkey subkey = new TElPGPSecretSubkey();
    subkey .Generate(password, 1024, SB_PGP_ALGORITHM_PK_RSA_ENCRYPT, false, 0);
    
  2. Next, you create a key binding signature over the subkey with the primary key:
    TElPGPSignature sig = new TElPGPSignature();
    secretKey.Sign(subkey.PublicKey, sig);
    subkey.PublicKey.AddSignature(sig);
    
  3. Finally, you add the subkey to the primary key’s list of subkeys:
    secretKey.AddSubkey(subkey);
    
Note that adding or removing a secret subkey affects both the secret and public parts of the key, so you need to update both your public and secret keyring files to propagate the change.

How To articles about OpenPGP key management

Discuss this help topic in SecureBlackbox Forum