com.jscape.pgp

## Class PgpKeystore

- java.lang.Object
- - com.jscape.pgp.PgpKeystore

-     public class PgpKeystore
      extends java.lang.Object

  PGP keystore. Contains public and secret PGP keyrings mapped to aliases.
  Author:
    Alex Usun

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PgpKeystore()` Creates a new empty keystore instance.
    `PgpKeystore(java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPPublicKeyRing> publicKeys, java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPSecretKeyRing> secretKeys)` Creates a new keystore from the public and secret ring maps.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(java.lang.String alias, org.bouncycastle.openpgp.PGPPublicKeyRing ring)` Adds a new public key to store.
    `void` | `add(java.lang.String alias, org.bouncycastle.openpgp.PGPSecretKeyRing ring)` Adds a new secret key to store.
    `org.bouncycastle.openpgp.PGPPublicKey` | `findEncryptionKey(java.lang.String alias)` Finds key with encryption capability.
    `org.bouncycastle.openpgp.PGPPublicKeyRing` | `findPublicKey(java.lang.String alias)` Finds public key for the specified alias.
    `org.bouncycastle.openpgp.PGPSecretKeyRing` | `findSecretKey(java.lang.String alias)` Finds secret key for the specified alias.
    `org.bouncycastle.openpgp.PGPSecretKey` | `findSigningKey(java.lang.String alias)` Finds key with signing capability.
    `java.lang.String[]` | `getPublicAliases()` Returns public keys aliases.
    `java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPPublicKeyRing>` | `getPublicKeys()` Returns public keys map.
    `java.lang.String[]` | `getSecretAliases()` Returns secret keys aliases.
    `java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPSecretKeyRing>` | `getSecretKeys()` Returns secret keys map.
    `void` | `setPublicKeys(java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPPublicKeyRing> value)` Sets public keys map.
    `void` | `setSecretKeys(java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPSecretKeyRing> value)` Sets secret keys map.
    `java.lang.String` | `toString()`

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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PgpKeystore

          public PgpKeystore(java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPPublicKeyRing> publicKeys,
                             java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPSecretKeyRing> secretKeys)

      Creates a new keystore from the public and secret ring maps.
      Parameters:
        `publicKeys` - public keyrings map
        `secretKeys` - secret keyrings map

    - #### PgpKeystore

          public PgpKeystore()

      Creates a new empty keystore instance.

  - ### Method Detail

    - #### getPublicKeys

          public java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPPublicKeyRing> getPublicKeys()

      Returns public keys map.
      Returns:
        public keys map

    - #### setPublicKeys

          public void setPublicKeys(java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPPublicKeyRing> value)

      Sets public keys map.
      Parameters:
        `value` - public keys map

    - #### getSecretKeys

          public java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPSecretKeyRing> getSecretKeys()

      Returns secret keys map.
      Returns:
        secret keys map

    - #### setSecretKeys

          public void setSecretKeys(java.util.Map<java.lang.String,org.bouncycastle.openpgp.PGPSecretKeyRing> value)

      Sets secret keys map.
      Parameters:
        `value` - secret keys map

    - #### getPublicAliases

          public java.lang.String[] getPublicAliases()

      Returns public keys aliases.
      Returns:
        public keys aliases

    - #### getSecretAliases

          public java.lang.String[] getSecretAliases()

      Returns secret keys aliases.
      Returns:
        secret keys aliases

    - #### add

          public void add(java.lang.String alias,
                          org.bouncycastle.openpgp.PGPPublicKeyRing ring)

      Adds a new public key to store.
      Parameters:
        `alias` - key alias
        `ring` - public key ring

    - #### add

          public void add(java.lang.String alias,
                          org.bouncycastle.openpgp.PGPSecretKeyRing ring)

      Adds a new secret key to store.
      Parameters:
        `alias` - key alias
        `ring` - secret key ring

    - #### findPublicKey

          public org.bouncycastle.openpgp.PGPPublicKeyRing findPublicKey(java.lang.String alias)

      Finds public key for the specified alias.
      Parameters:
        `alias` - key alias
      Returns:
        key or `null` if key is not found

    - #### findEncryptionKey

          public org.bouncycastle.openpgp.PGPPublicKey findEncryptionKey(java.lang.String alias)

      Finds key with encryption capability.
      Parameters:
        `alias` - key alias
      Returns:
        key or `null` if key is not found

    - #### findSecretKey

          public org.bouncycastle.openpgp.PGPSecretKeyRing findSecretKey(java.lang.String alias)

      Finds secret key for the specified alias.
      Parameters:
        `alias` - key alias
      Returns:
        key or `null` if key is not found

    - #### findSigningKey

          public org.bouncycastle.openpgp.PGPSecretKey findSigningKey(java.lang.String alias)

      Finds key with signing capability.
      Parameters:
        `alias` - key alias
      Returns:
        key or `null` if key is not found

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © JSCAPE LLC. 1999-2018. All Rights Reserved