Package org.pgpainless.key.generation

# Class KeyRingBuilder

java.lang.Object
org.pgpainless.key.generation.KeyRingBuilder

All Implemented Interfaces:
  `KeyRingBuilderInterface<KeyRingBuilder>`

public class KeyRingBuilder extends Object implements KeyRingBuilderInterface<KeyRingBuilder>

## Constructor Summary

Constructors
Constructor
Description
`KeyRingBuilder()`

## Method Summary

Modifier and Type
Method
Description
`KeyRingBuilder`
`addSubkey(KeySpec keySpec)`
`KeyRingBuilder`
`addUserId(byte[] userId)`
`KeyRingBuilder`
`addUserId(String userId)`
`KeyRingBuilder`
`addUserId(String userId, SelfSignatureSubpackets.Callback subpacketsCallback)`
`org.bouncycastle.openpgp.PGPSecretKeyRing`
`build()`
`static org.bouncycastle.openpgp.PGPKeyPair`
`generateKeyPair(KeySpec spec)`
`static org.bouncycastle.openpgp.PGPKeyPair`
`generateKeyPair(KeySpec spec, Date keyCreationDate)`
`KeyRingBuilder`
`setExpirationDate(Date expirationDate)`
`KeyRingBuilder`
`setPassphrase(Passphrase passphrase)`
`KeyRingBuilder`
`setPrimaryKey(KeySpec keySpec)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.pgpainless.key.generation.KeyRingBuilderInterface

`addSubkey, addUserId, setPrimaryKey`

## Constructor Details

### KeyRingBuilder

public KeyRingBuilder()

## Method Details

### setPrimaryKey

public KeyRingBuilder setPrimaryKey(@Nonnull KeySpec keySpec)

Specified by:
  `setPrimaryKey` in interface `KeyRingBuilderInterface<KeyRingBuilder>`

### addSubkey

public KeyRingBuilder addSubkey(@Nonnull KeySpec keySpec)

Specified by:
  `addSubkey` in interface `KeyRingBuilderInterface<KeyRingBuilder>`

### addUserId

public KeyRingBuilder addUserId(@Nonnull String userId)

Specified by:
  `addUserId` in interface `KeyRingBuilderInterface<KeyRingBuilder>`

### addUserId

public KeyRingBuilder addUserId(@Nonnull String userId, @Nullable SelfSignatureSubpackets.Callback subpacketsCallback)

### addUserId

public KeyRingBuilder addUserId(@Nonnull byte[] userId)

Specified by:
  `addUserId` in interface `KeyRingBuilderInterface<KeyRingBuilder>`

### setExpirationDate

public KeyRingBuilder setExpirationDate(@Nullable Date expirationDate)

Specified by:
  `setExpirationDate` in interface `KeyRingBuilderInterface<KeyRingBuilder>`

### setPassphrase

public KeyRingBuilder setPassphrase(@Nonnull Passphrase passphrase)

Specified by:
  `setPassphrase` in interface `KeyRingBuilderInterface<KeyRingBuilder>`

### build

public org.bouncycastle.openpgp.PGPSecretKeyRing build() throws NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException

Specified by:
  `build` in interface `KeyRingBuilderInterface<KeyRingBuilder>`
Throws:
  `NoSuchAlgorithmException`
  `org.bouncycastle.openpgp.PGPException`
  `InvalidAlgorithmParameterException`

### generateKeyPair

public static org.bouncycastle.openpgp.PGPKeyPair generateKeyPair(KeySpec spec) throws NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException

Throws:
  `NoSuchAlgorithmException`
  `org.bouncycastle.openpgp.PGPException`
  `InvalidAlgorithmParameterException`

### generateKeyPair

public static org.bouncycastle.openpgp.PGPKeyPair generateKeyPair(KeySpec spec, Date keyCreationDate) throws NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException

Throws:
  `NoSuchAlgorithmException`
  `org.bouncycastle.openpgp.PGPException`
  `InvalidAlgorithmParameterException`