Top Description Fields Constructors Methods
org.bouncycastle.gpg

public Class SExprParser

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .ByteArrayOutputStream, .IOException, .InputStream, .OutputStream, java.math.BigInteger, java.util.Date, org.bouncycastle.asn1.x9.ECNamedCurveTable, org.bouncycastle.bcpg.DSAPublicBCPGKey, .DSASecretBCPGKey, .ECDSAPublicBCPGKey, .ECPublicBCPGKey, .ECSecretBCPGKey, .ElGamalPublicBCPGKey, .ElGamalSecretBCPGKey, .HashAlgorithmTags, .PublicKeyAlgorithmTags, .PublicKeyPacket, .RSAPublicBCPGKey, .RSASecretBCPGKey, .S2K, .SecretKeyPacket, .SymmetricKeyAlgorithmTags, org.bouncycastle.openpgp.PGPException, .PGPPublicKey, .PGPSecretKey, org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator, .PBEProtectionRemoverFactory, .PBESecretKeyDecryptor, .PGPDigestCalculator, .PGPDigestCalculatorProvider, org.bouncycastle.util.Arrays, .Strings

A parser for secret keys stored in SExpr

Field Summary

Modifier and TypeField and Description
private final PGPDigestCalculatorProvider

Constructor Summary

AccessConstructor and Description
public
SExprParser(PGPDigestCalculatorProvider
a provider for digest calculations. Used to confirm key protection hashes.
digestProvider
)

Base constructor.

Method Summary

Modifier and TypeMethod and Description
private static byte[][]
extractData(InputStream inputStream, PBEProtectionRemoverFactory keyProtectionRemoverFactory)

public PGPSecretKey

Returns:

a secret key object.
parseSecretKey
(InputStream inputStream, PBEProtectionRemoverFactory keyProtectionRemoverFactory, PGPPublicKey pubKey)

Parse a secret key from one of the GPG S expression keys associating it with the passed in public key.

public PGPSecretKey

Returns:

a secret key object.
parseSecretKey
(InputStream inputStream, PBEProtectionRemoverFactory keyProtectionRemoverFactory, KeyFingerPrintCalculator fingerPrintCalculator)

Parse a secret key from one of the GPG S expression keys.

private BigInteger
private BigInteger
processECSecretKey(InputStream inputStream, String curveID, String curveName, byte[] qVal, PBEProtectionRemoverFactory keyProtectionRemoverFactory)

private BigInteger
private BigInteger[]
processRSASecretKey(InputStream inputStream, BigInteger n, BigInteger e, PBEProtectionRemoverFactory keyProtectionRemoverFactory)

private BigInteger
readBigInteger(String expectedType, InputStream inputStream)

private void
private void
writeCanonical(OutputStream dOut, String label, byte[] data)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

digestProviderback to summary
private final PGPDigestCalculatorProvider digestProvider

Constructor Detail

SExprParserback to summary
public SExprParser(PGPDigestCalculatorProvider digestProvider)

Base constructor.

Parameters
digestProvider:PGPDigestCalculatorProvider

a provider for digest calculations. Used to confirm key protection hashes.

Method Detail

extractDataback to summary
private static byte[][] extractData(InputStream inputStream, PBEProtectionRemoverFactory keyProtectionRemoverFactory) throws PGPException, IOException
parseSecretKeyback to summary
public PGPSecretKey parseSecretKey(InputStream inputStream, PBEProtectionRemoverFactory keyProtectionRemoverFactory, PGPPublicKey pubKey) throws IOException, PGPException

Parse a secret key from one of the GPG S expression keys associating it with the passed in public key.

Returns:PGPSecretKey

a secret key object.

parseSecretKeyback to summary
public PGPSecretKey parseSecretKey(InputStream inputStream, PBEProtectionRemoverFactory keyProtectionRemoverFactory, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException, PGPException

Parse a secret key from one of the GPG S expression keys.

Returns:PGPSecretKey

a secret key object.

processDSASecretKeyback to summary
private BigInteger processDSASecretKey(InputStream inputStream, BigInteger p, BigInteger q, BigInteger g, BigInteger y, PBEProtectionRemoverFactory keyProtectionRemoverFactory) throws IOException, PGPException
processECSecretKeyback to summary
private BigInteger processECSecretKey(InputStream inputStream, String curveID, String curveName, byte[] qVal, PBEProtectionRemoverFactory keyProtectionRemoverFactory) throws IOException, PGPException
processElGamalSecretKeyback to summary
private BigInteger processElGamalSecretKey(InputStream inputStream, BigInteger p, BigInteger g, BigInteger y, PBEProtectionRemoverFactory keyProtectionRemoverFactory) throws IOException, PGPException
processRSASecretKeyback to summary
private BigInteger[] processRSASecretKey(InputStream inputStream, BigInteger n, BigInteger e, PBEProtectionRemoverFactory keyProtectionRemoverFactory) throws IOException, PGPException
readBigIntegerback to summary
private BigInteger readBigInteger(String expectedType, InputStream inputStream) throws IOException, PGPException
writeCanonicalback to summary
private void writeCanonical(OutputStream dOut, String label, BigInteger i) throws IOException
writeCanonicalback to summary
private void writeCanonical(OutputStream dOut, String label, byte[] data) throws IOException