Top Fields Constructors Methods
org.bouncycastle.openpgp.operator.jcajce

public Class JcaPGPKeyConverter

extends Object
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, java.security.AlgorithmParameters, .GeneralSecurityException, .KeyFactory, .NoSuchAlgorithmException, .NoSuchProviderException, .PrivateKey, .Provider, .PublicKey, java.security.interfaces.DSAParams, .DSAPrivateKey, .DSAPublicKey, .ECPrivateKey, .ECPublicKey, .RSAPrivateCrtKey, .RSAPublicKey, java.security.spec.DSAPrivateKeySpec, .DSAPublicKeySpec, .ECGenParameterSpec, .ECParameterSpec, .ECPrivateKeySpec, .ECPublicKeySpec, .InvalidParameterSpecException, .KeySpec, .PKCS8EncodedKeySpec, .RSAPrivateCrtKeySpec, .RSAPublicKeySpec, .X509EncodedKeySpec, java.util.Date, javax.crypto.interfaces.DHPrivateKey, .DHPublicKey, javax.crypto.spec.DHParameterSpec, .DHPrivateKeySpec, .DHPublicKeySpec, org.bouncycastle.asn1.ASN1ObjectIdentifier, .ASN1OctetString, .DEROctetString, org.bouncycastle.asn1.gnu.GNUObjectIdentifiers, org.bouncycastle.asn1.pkcs.PrivateKeyInfo, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .SubjectPublicKeyInfo, org.bouncycastle.asn1.x9.ECNamedCurveTable, .X9ECParameters, .X9ECParametersHolder, .X9ECPoint, org.bouncycastle.bcpg.BCPGKey, .DSAPublicBCPGKey, .DSASecretBCPGKey, .ECDHPublicBCPGKey, .ECDSAPublicBCPGKey, .ECPublicBCPGKey, .ECSecretBCPGKey, .EdDSAPublicBCPGKey, .EdSecretBCPGKey, .ElGamalPublicBCPGKey, .ElGamalSecretBCPGKey, .HashAlgorithmTags, .PublicKeyAlgorithmTags, .PublicKeyPacket, .RSAPublicBCPGKey, .RSASecretBCPGKey, .SymmetricKeyAlgorithmTags, org.bouncycastle.jcajce.util.DefaultJcaJceHelper, .NamedJcaJceHelper, .ProviderJcaJceHelper, org.bouncycastle.math.ec.ECPoint, org.bouncycastle.openpgp.PGPAlgorithmParameters, .PGPException, .PGPKdfParameters, .PGPPrivateKey, .PGPPublicKey, org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator, org.bouncycastle.util.Arrays, .BigIntegers

Field Summary

Modifier and TypeField and Description
private static final PGPKdfParameters
private static final int
private KeyFingerPrintCalculator
private OperatorHelper
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private ECParameterSpec
private ECParameterSpec
public PGPPrivateKey

Returns:

a PGPPrivateKey
getPGPPrivateKey
(PGPPublicKey
the corresponding PGPPublicKey to privKey.
pub
,
PrivateKey
the private key for the key in pub.
privKey
)

Convert a PrivateKey into a PGPPrivateKey.

public PGPPublicKey
getPGPPublicKey(int
asymmetric algorithm type representing the public key.
algorithm
,
PGPAlgorithmParameters
additional parameters to be stored against the public key.
algorithmParameters
,
PublicKey
actual public key to associate.
pubKey
,
Date
date of creation.
time
)

Create a PGPPublicKey from the passed in JCA one.

public PGPPublicKey
getPGPPublicKey(int
asymmetric algorithm type representing the public key.
algorithm
,
PublicKey
actual public key to associate.
pubKey
,
Date
date of creation.
time
)

Create a PGPPublicKey from the passed in JCA one.

private BCPGKey
public PrivateKey
private BCPGKey
getPublicBCPGKey(int algorithm, PGPAlgorithmParameters algorithmParameters, PublicKey pubKey, Date time)

public PublicKey
private PrivateKey
implGeneratePrivate(String keyAlgorithm, KeySpec keySpec)

private PublicKey
implGeneratePublic(String keyAlgorithm, KeySpec keySpec)

private PGPKdfParameters
private PrivateKey
private PrivateKey
implGetPrivateKeyPKCS8(String keyAlgorithm, PrivateKeyInfo privateKeyInfo)

private PublicKey
private PublicKey
implGetPublicKeyX509(String keyAlgorithm, SubjectPublicKeyInfo subjectPublicKeyInfo)

private static byte[]
reverseInPlace(byte[] a)

public JcaPGPKeyConverter
public JcaPGPKeyConverter
setProvider(String providerName)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_KDF_PARAMETERSback to summary
private static final PGPKdfParameters DEFAULT_KDF_PARAMETERS
ED25519_KEY_SIZEback to summary
private static final int ED25519_KEY_SIZE
fingerPrintCalculatorback to summary
private KeyFingerPrintCalculator fingerPrintCalculator
helperback to summary
private OperatorHelper helper
X25519_KEY_SIZEback to summary
private static final int X25519_KEY_SIZE

Constructor Detail

JcaPGPKeyConverterback to summary
public JcaPGPKeyConverter()

Method Detail

getECParameterSpecback to summary
private ECParameterSpec getECParameterSpec(ASN1ObjectIdentifier curveOid) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidParameterSpecException
getECParameterSpecback to summary
private ECParameterSpec getECParameterSpec(ASN1ObjectIdentifier curveOid, X9ECParameters x9Params) throws InvalidParameterSpecException, NoSuchProviderException, NoSuchAlgorithmException
getPGPPrivateKeyback to summary
public PGPPrivateKey getPGPPrivateKey(PGPPublicKey pub, PrivateKey privKey) throws PGPException

Convert a PrivateKey into a PGPPrivateKey.

Parameters
pub:PGPPublicKey

the corresponding PGPPublicKey to privKey.

privKey:PrivateKey

the private key for the key in pub.

Returns:PGPPrivateKey

a PGPPrivateKey

getPGPPublicKeyback to summary
public PGPPublicKey getPGPPublicKey(int algorithm, PGPAlgorithmParameters algorithmParameters, PublicKey pubKey, Date time) throws PGPException

Create a PGPPublicKey from the passed in JCA one.

Note

the time passed in affects the value of the key's keyID, so you probably only want to do this once for a JCA key, or make sure you keep track of the time you used.

Parameters
algorithm:int

asymmetric algorithm type representing the public key.

algorithmParameters:PGPAlgorithmParameters

additional parameters to be stored against the public key.

pubKey:PublicKey

actual public key to associate.

time:Date

date of creation.

Exceptions
PGPException:
on key creation problem.
getPGPPublicKeyback to summary
public PGPPublicKey getPGPPublicKey(int algorithm, PublicKey pubKey, Date time) throws PGPException

Create a PGPPublicKey from the passed in JCA one.

Note

the time passed in affects the value of the key's keyID, so you probably only want to do this once for a JCA key, or make sure you keep track of the time you used.

Parameters
algorithm:int

asymmetric algorithm type representing the public key.

pubKey:PublicKey

actual public key to associate.

time:Date

date of creation.

Exceptions
PGPException:
on key creation problem.
getPrivateBCPGKeyback to summary
private BCPGKey getPrivateBCPGKey(PGPPublicKey pub, PrivateKey privKey) throws PGPException
getPrivateKeyback to summary
public PrivateKey getPrivateKey(PGPPrivateKey privKey) throws PGPException
getPublicBCPGKeyback to summary
private BCPGKey getPublicBCPGKey(int algorithm, PGPAlgorithmParameters algorithmParameters, PublicKey pubKey, Date time) throws PGPException
getPublicKeyback to summary
public PublicKey getPublicKey(PGPPublicKey publicKey) throws PGPException
implGeneratePrivateback to summary
private PrivateKey implGeneratePrivate(String keyAlgorithm, KeySpec keySpec) throws GeneralSecurityException, PGPException
implGeneratePublicback to summary
private PublicKey implGeneratePublic(String keyAlgorithm, KeySpec keySpec) throws GeneralSecurityException, PGPException
implGetKdfParametersback to summary
private PGPKdfParameters implGetKdfParameters(PGPAlgorithmParameters algorithmParameters)
implGetPrivateKeyECback to summary
private PrivateKey implGetPrivateKeyEC(String keyAlgorithm, ECPublicBCPGKey ecPub, ECSecretBCPGKey ecPriv) throws GeneralSecurityException, PGPException
implGetPrivateKeyPKCS8back to summary
private PrivateKey implGetPrivateKeyPKCS8(String keyAlgorithm, PrivateKeyInfo privateKeyInfo) throws GeneralSecurityException, IOException, PGPException
implGetPublicKeyECback to summary
private PublicKey implGetPublicKeyEC(String keyAlgorithm, ECPublicBCPGKey ecPub) throws GeneralSecurityException, IOException, PGPException
implGetPublicKeyX509back to summary
private PublicKey implGetPublicKeyX509(String keyAlgorithm, SubjectPublicKeyInfo subjectPublicKeyInfo) throws GeneralSecurityException, IOException, PGPException
reverseInPlaceback to summary
private static byte[] reverseInPlace(byte[] a)
setProviderback to summary
public JcaPGPKeyConverter setProvider(Provider provider)
setProviderback to summary
public JcaPGPKeyConverter setProvider(String providerName)