Class SExprParser

java.lang.Object
org.eclipse.jgit.gpg.bc.internal.keys.SExprParser

public class SExprParser extends Object
A parser for secret keys stored in s-expressions. Original BouncyCastle code modified by the JGit team to:
  • handle unencrypted DSA, EC, and ElGamal keys (upstream only handles unencrypted RSA), and
  • handle secret keys using AES/OCB as encryption (those don't have a hash).
  • Constructor Summary

    Constructors
    Constructor
    Description
    SExprParser(org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider digestProvider)
    Base constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bouncycastle.openpgp.PGPSecretKey
    parseSecretKey(InputStream inputStream, org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory keyProtectionRemoverFactory, org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator fingerPrintCalculator)
    Parse a secret key from one of the GPG S expression keys.
    org.bouncycastle.openpgp.PGPSecretKey
    parseSecretKey(InputStream inputStream, org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory keyProtectionRemoverFactory, org.bouncycastle.openpgp.PGPPublicKey pubKey)
    Parse a secret key from one of the GPG S expression keys associating it with the passed in public key.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SExprParser

      public SExprParser(org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider digestProvider)
      Base constructor.
      Parameters:
      digestProvider - a provider for digest calculations. Used to confirm key protection hashes.
  • Method Details

    • parseSecretKey

      public org.bouncycastle.openpgp.PGPSecretKey parseSecretKey(InputStream inputStream, org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory keyProtectionRemoverFactory, org.bouncycastle.openpgp.PGPPublicKey pubKey) throws IOException, org.bouncycastle.openpgp.PGPException
      Parse a secret key from one of the GPG S expression keys associating it with the passed in public key.
      Parameters:
      inputStream - to read from
      keyProtectionRemoverFactory - for decrypting encrypted keys
      pubKey - the private key should belong to
      Returns:
      a secret key object.
      Throws:
      IOException
      org.bouncycastle.openpgp.PGPException
    • parseSecretKey

      public org.bouncycastle.openpgp.PGPSecretKey parseSecretKey(InputStream inputStream, org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory keyProtectionRemoverFactory, org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator fingerPrintCalculator) throws IOException, org.bouncycastle.openpgp.PGPException
      Parse a secret key from one of the GPG S expression keys.
      Parameters:
      inputStream - to read from
      keyProtectionRemoverFactory - for decrypting encrypted keys
      fingerPrintCalculator - for calculating key fingerprints
      Returns:
      a secret key object.
      Throws:
      IOException
      org.bouncycastle.openpgp.PGPException