java.lang.Object
org.eclipse.jgit.gpg.bc.internal.keys.SExprParser
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)
- handle secret keys using AES/OCB as encryption (those don't have a hash)
- fix EC parsing to account for "flags" sub-list present for ed25519 and curve25519
- add support for ed25519 OIDs unknown to BouncyCastle
-
Constructor Summary
ConstructorsConstructorDescriptionSExprParser(org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider digestProvider) Base constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.bouncycastle.openpgp.PGPSecretKeyparseSecretKey(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.PGPSecretKeyparseSecretKey(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.
-
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 fromkeyProtectionRemoverFactory- for decrypting encrypted keyspubKey- the private key should belong to- Returns:
- a secret key object.
- Throws:
IOException- if an IO error occurredorg.bouncycastle.openpgp.PGPException- if some PGP error occurred
-
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 fromkeyProtectionRemoverFactory- for decrypting encrypted keysfingerPrintCalculator- for calculating key fingerprints- Returns:
- a secret key object.
- Throws:
IOException- if an IO error occurredorg.bouncycastle.openpgp.PGPException- if a PGP error occurred
-