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

public Class JcaPGPKeyConverter

extends PGPKeyConverter
Class Inheritance
Imports
java.io.IOException, java.math.BigInteger, java.security.AlgorithmParameters, .GeneralSecurityException, .KeyFactory, .PrivateKey, .Provider, .PublicKey, java.security.interfaces.DSAParams, .DSAPrivateKey, .DSAPublicKey, .ECPrivateKey, .RSAPrivateCrtKey, .RSAPublicKey, java.security.spec.DSAPrivateKeySpec, .DSAPublicKeySpec, .ECParameterSpec, .ECPrivateKeySpec, .ECPublicKeySpec, .KeySpec, .PKCS8EncodedKeySpec, .RSAPrivateCrtKeySpec, .RSAPublicKeySpec, .X509EncodedKeySpec, java.util.Date, .Enumeration, javax.crypto.interfaces.DHPrivateKey, .DHPublicKey, javax.crypto.spec.DHParameterSpec, .DHPrivateKeySpec, .DHPublicKeySpec, org.bouncycastle.asn1.ASN1Encodable, .ASN1ObjectIdentifier, .ASN1OctetString, .DEROctetString, org.bouncycastle.asn1.cryptlib.CryptlibObjectIdentifiers, org.bouncycastle.asn1.edec.EdECObjectIdentifiers, org.bouncycastle.asn1.gnu.GNUObjectIdentifiers, org.bouncycastle.asn1.pkcs.PrivateKeyInfo, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .SubjectPublicKeyInfo, org.bouncycastle.asn1.x9.ECNamedCurveTable, .X962Parameters, .X9ECParameters, .X9ECParametersHolder, .X9ECPoint, .X9ObjectIdentifiers, org.bouncycastle.bcpg.BCPGKey, .DSAPublicBCPGKey, .DSASecretBCPGKey, .ECDHPublicBCPGKey, .ECDSAPublicBCPGKey, .ECPublicBCPGKey, .ECSecretBCPGKey, .Ed25519PublicBCPGKey, .Ed25519SecretBCPGKey, .Ed448PublicBCPGKey, .Ed448SecretBCPGKey, .EdDSAPublicBCPGKey, .EdSecretBCPGKey, .ElGamalPublicBCPGKey, .ElGamalSecretBCPGKey, .PublicKeyAlgorithmTags, .PublicKeyPacket, .RSAPublicBCPGKey, .RSASecretBCPGKey, .X25519PublicBCPGKey, .X25519SecretBCPGKey, .X448PublicBCPGKey, .X448SecretBCPGKey, org.bouncycastle.crypto.CryptoServicesRegistrar, org.bouncycastle.jcajce.util.DefaultJcaJceHelper, .NamedJcaJceHelper, .ProviderJcaJceHelper, org.bouncycastle.math.ec.ECCurve, .ECPoint, org.bouncycastle.math.ec.rfc7748.X25519, .X448, org.bouncycastle.math.ec.rfc8032.Ed25519, .Ed448, org.bouncycastle.openpgp.PGPAlgorithmParameters, .PGPException, .PGPKdfParameters, .PGPPrivateKey, .PGPPublicKey, org.bouncycastle.openpgp.operator.KeyFingerPrintCalculator, .PGPKeyConverter, org.bouncycastle.util.Arrays, .BigIntegers

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
private static interface

Field Summary

Modifier and TypeField and Description
private KeyFingerPrintCalculator
private OperatorHelper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private PublicKey
private PublicKey
get448PublicKey(BigInteger x, ASN1ObjectIdentifier algorithm, String keyAlgorithm, String name)

private ECParameterSpec
private ASN1Encodable
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 version 4 PGPPublicKey from the passed in JCA one.

public PGPPublicKey
getPGPPublicKey(int
key version.
version
,
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
)
Deprecated use versioned getPGPPublicKey(int, int, PublicKey, Date) instead.

Create a version 4 PGPPublicKey from the passed in JCA one.

public PGPPublicKey
getPGPPublicKey(int
key version.
version
,
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 byte[]
getPointEncUncompressed(PublicKey pubKey, int publicKeySize)

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

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

private PublicKey
implGeneratePublic(String keyAlgorithm, KeySpec keySpec)

private PrivateKey
private PublicKey
private PublicKey
implGetPublicKeyX509(byte[] pEnc, int pEncOff, ASN1ObjectIdentifier algorithm, String keyAlgorithm)

public JcaPGPKeyConverter
public JcaPGPKeyConverter
setProvider(String providerName)

Inherited from org.bouncycastle.openpgp.operator.PGPKeyConverter:
getPrivateKeyInfogetPrivateKeyInfoimplGetKdfParameters

Field Detail

fingerPrintCalculatorback to summary
private KeyFingerPrintCalculator fingerPrintCalculator
helperback to summary
private OperatorHelper helper

Constructor Detail

JcaPGPKeyConverterback to summary
public JcaPGPKeyConverter()

Method Detail

get25519PublicKeyback to summary
private PublicKey get25519PublicKey(BigInteger x, ASN1ObjectIdentifier algorithm, String keyAlgorithm, String name) throws PGPException, GeneralSecurityException, IOException
get448PublicKeyback to summary
private PublicKey get448PublicKey(BigInteger x, ASN1ObjectIdentifier algorithm, String keyAlgorithm, String name) throws PGPException, GeneralSecurityException, IOException
getECParameterSpecback to summary
private ECParameterSpec getECParameterSpec(ASN1ObjectIdentifier curveOid) throws IOException, GeneralSecurityException
getNamedCurveOIDback to summary
private ASN1Encodable getNamedCurveOID(X962Parameters ecParams)
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 version 4 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.

Annotations
@Deprecated
Exceptions
PGPException:
on key creation problem.
getPGPPublicKeyback to summary
public PGPPublicKey getPGPPublicKey(int version, 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
version:int

key version.

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

Deprecated

use versioned getPGPPublicKey(int, int, PublicKey, Date) instead.

Create a version 4 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.

Annotations
@Deprecated
Exceptions
PGPException:
on key creation problem.
getPGPPublicKeyback to summary
public PGPPublicKey getPGPPublicKey(int version, 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
version:int

key version.

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.
getPointEncUncompressedback to summary
private byte[] getPointEncUncompressed(PublicKey pubKey, int publicKeySize)
getPrivateBCPGKeyback to summary
private BCPGKey getPrivateBCPGKey(PrivateKey privKey, JcaPGPKeyConverter.BCPGKeyOperation operation) throws PGPException
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) throws PGPException
getPublicBCPGKeyback to summary
private BCPGKey getPublicBCPGKey(PublicKey pubKey, int keySize, JcaPGPKeyConverter.BCPGKeyOperation operation)
getPublicKeyback to summary
public PublicKey getPublicKey(PGPPublicKey publicKey) throws PGPException
implGeneratePrivateback to summary
private PrivateKey implGeneratePrivate(String keyAlgorithm, JcaPGPKeyConverter.Operation operation) throws GeneralSecurityException, PGPException, IOException
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
implGetPrivateKeyECback to summary
private PrivateKey implGetPrivateKeyEC(String keyAlgorithm, ECPublicBCPGKey ecPub, ECSecretBCPGKey ecPriv) throws GeneralSecurityException, PGPException, IOException
implGetPublicKeyECback to summary
private PublicKey implGetPublicKeyEC(String keyAlgorithm, ECPublicBCPGKey ecPub) throws GeneralSecurityException, IOException, PGPException
implGetPublicKeyX509back to summary
private PublicKey implGetPublicKeyX509(byte[] pEnc, int pEncOff, ASN1ObjectIdentifier algorithm, String keyAlgorithm) throws IOException, PGPException, GeneralSecurityException
setProviderback to summary
public JcaPGPKeyConverter setProvider(Provider provider)
setProviderback to summary
public JcaPGPKeyConverter setProvider(String providerName)
org.bouncycastle.openpgp.operator.jcajce back to summary

private Interface JcaPGPKeyConverter.BCPGKeyOperation

Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public BCPGKey
getBCPGKey(byte[] key)

Method Detail

getBCPGKeyback to summary
public BCPGKey getBCPGKey(byte[] key)
org.bouncycastle.openpgp.operator.jcajce back to summary

private Interface JcaPGPKeyConverter.Operation

Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public PrivateKeyInfo

Method Detail

getPrivateKeyInfosback to summary
public PrivateKeyInfo getPrivateKeyInfos() throws IOException