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

public Class JcePublicKeyDataDecryptorFactoryBuilder

extends Object
Class Inheritance
Imports
java.io.IOException, java.security.GeneralSecurityException, .InvalidKeyException, .Key, .KeyFactory, .PrivateKey, .Provider, .PublicKey, java.security.interfaces.RSAKey, java.security.spec.AlgorithmParameterSpec, .X509EncodedKeySpec, java.util.Date, javax.crypto.Cipher, javax.crypto.interfaces.DHKey, org.bouncycastle.asn1.ASN1ObjectIdentifier, org.bouncycastle.asn1.edec.EdECObjectIdentifiers, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .SubjectPublicKeyInfo, org.bouncycastle.asn1.x9.ECNamedCurveTable, .X9ECParametersHolder, org.bouncycastle.bcpg.AEADEncDataPacket, .ECDHPublicBCPGKey, .PublicKeyAlgorithmTags, .PublicKeyPacket, .SymmetricEncIntegrityPacket, .SymmetricKeyAlgorithmTags, .X25519PublicBCPGKey, .X448PublicBCPGKey, org.bouncycastle.jcajce.spec.UserKeyingMaterialSpec, org.bouncycastle.jcajce.util.DefaultJcaJceHelper, .NamedJcaJceHelper, .ProviderJcaJceHelper, org.bouncycastle.math.ec.ECPoint, org.bouncycastle.openpgp.PGPException, .PGPPrivateKey, .PGPPublicKey, .PGPSessionKey, org.bouncycastle.openpgp.operator.AbstractPublicKeyDataDecryptorFactory, .PGPDataDecryptor, .PGPPad, .PublicKeyDataDecryptorFactory, .RFC6637Utils, org.bouncycastle.util.Arrays

Field Summary

Modifier and TypeField and Description
private JceAEADUtil
private OperatorHelper
private JcaKeyFingerprintCalculator
private OperatorHelper
private JcaPGPKeyConverter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PublicKeyDataDecryptorFactory
build(final PrivateKey privKey)

public PublicKeyDataDecryptorFactory
build(final PGPPrivateKey privKey)

private static void
checkRange(int pLen, byte[] enc)

private byte[]

Returns:

decrypted session key
decryptSessionData
(JcaPGPKeyConverter
key converter
converter
,
PGPPrivateKey
our private key
privKey
,
byte[][]
encrypted session key
secKeyData
)

Decrypt ECDH encrypted session keys.

private byte[]

Returns:

decrypted session data
decryptSessionData
(JcaPGPKeyConverter
key converter
converter
,
PGPPrivateKey
our private key
privKey
,
byte[]
encrypted session key
enc
,
int
Key length
pLen
,
String
agreement algorithm
agreementAlgorithm
,
int
wrapping algorithm
symmetricKeyAlgorithm
,
ASN1ObjectIdentifier
ephemeral key algorithm identifier
algorithmIdentifier
,
String
public key algorithm name
algorithmName
,
boolean
whether the PKESK packet is version 3
containsSKAlg
)

Decrypt X25519 / X448 encrypted session keys.

private byte[]

Returns:

session data
decryptSessionData
(int
public key algorithm
keyAlgorithm
,
PrivateKey
our private key
privKey
,
int
payload size
expectedPayloadSize
,
byte[][]
ESK data
secKeyData
)

Decrypt RSA / Elgamal encrypted session keys.

private int
private PublicKey
getPublicKey(byte[] pEnc, ASN1ObjectIdentifier algprithmIdentifier, int pEncOff)

private Key
getSessionKey(JcaPGPKeyConverter converter, PGPPrivateKey privKey, String agreementName, PublicKey publicKey, int symmetricKeyAlgorithm, byte[] keyEnc, AlgorithmParameterSpec ukms)

public JcePublicKeyDataDecryptorFactoryBuilder
public JcePublicKeyDataDecryptorFactoryBuilder
setContentProvider(String providerName)

public JcePublicKeyDataDecryptorFactoryBuilder

Returns:

the current builder.
setProvider
(Provider
provider object for cryptographic primitives.
provider
)

Set the provider object to use for creating cryptographic primitives in the resulting factory the builder produces.

public JcePublicKeyDataDecryptorFactoryBuilder

Returns:

the current builder.
setProvider
(String
the name of the provider to reference for cryptographic primitives.
providerName
)

Set the provider name to use for creating cryptographic primitives in the resulting factory the builder produces.

private void
updateWithMPI(Cipher c, int expectedPayloadSize, byte[] encMPI)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aeadHelperback to summary
private JceAEADUtil aeadHelper
contentHelperback to summary
private OperatorHelper contentHelper
fingerprintCalculatorback to summary
private JcaKeyFingerprintCalculator fingerprintCalculator
helperback to summary
private OperatorHelper helper
keyConverterback to summary
private JcaPGPKeyConverter keyConverter

Constructor Detail

JcePublicKeyDataDecryptorFactoryBuilderback to summary
public JcePublicKeyDataDecryptorFactoryBuilder()

Method Detail

buildback to summary
public PublicKeyDataDecryptorFactory build(final PrivateKey privKey)
buildback to summary
public PublicKeyDataDecryptorFactory build(final PGPPrivateKey privKey)
checkRangeback to summary
private static void checkRange(int pLen, byte[] enc) throws PGPException
decryptSessionDataback to summary
private byte[] decryptSessionData(JcaPGPKeyConverter converter, PGPPrivateKey privKey, byte[][] secKeyData) throws PGPException

Decrypt ECDH encrypted session keys.

Parameters
converter:JcaPGPKeyConverter

key converter

privKey:PGPPrivateKey

our private key

secKeyData:byte[][]

encrypted session key

Returns:byte[]

decrypted session key

decryptSessionDataback to summary
private byte[] decryptSessionData(JcaPGPKeyConverter converter, PGPPrivateKey privKey, byte[] enc, int pLen, String agreementAlgorithm, int symmetricKeyAlgorithm, ASN1ObjectIdentifier algorithmIdentifier, String algorithmName, boolean containsSKAlg) throws PGPException

Decrypt X25519 / X448 encrypted session keys.

Parameters
converter:JcaPGPKeyConverter

key converter

privKey:PGPPrivateKey

our private key

enc:byte[]

encrypted session key

pLen:int

Key length

agreementAlgorithm:String

agreement algorithm

symmetricKeyAlgorithm:int

wrapping algorithm

algorithmIdentifier:ASN1ObjectIdentifier

ephemeral key algorithm identifier

algorithmName:String

public key algorithm name

containsSKAlg:boolean

whether the PKESK packet is version 3

Returns:byte[]

decrypted session data

decryptSessionDataback to summary
private byte[] decryptSessionData(int keyAlgorithm, PrivateKey privKey, int expectedPayloadSize, byte[][] secKeyData) throws PGPException

Decrypt RSA / Elgamal encrypted session keys.

Parameters
keyAlgorithm:int

public key algorithm

privKey:PrivateKey

our private key

expectedPayloadSize:int

payload size

secKeyData:byte[][]

ESK data

Returns:byte[]

session data

getExpectedPayloadSizeback to summary
private int getExpectedPayloadSize(PrivateKey key)
getPublicKeyback to summary
private PublicKey getPublicKey(byte[] pEnc, ASN1ObjectIdentifier algprithmIdentifier, int pEncOff) throws PGPException, GeneralSecurityException, IOException
getSessionKeyback to summary
private Key getSessionKey(JcaPGPKeyConverter converter, PGPPrivateKey privKey, String agreementName, PublicKey publicKey, int symmetricKeyAlgorithm, byte[] keyEnc, AlgorithmParameterSpec ukms) throws PGPException, GeneralSecurityException
setContentProviderback to summary
public JcePublicKeyDataDecryptorFactoryBuilder setContentProvider(Provider provider)
setContentProviderback to summary
public JcePublicKeyDataDecryptorFactoryBuilder setContentProvider(String providerName)
setProviderback to summary
public JcePublicKeyDataDecryptorFactoryBuilder setProvider(Provider provider)

Set the provider object to use for creating cryptographic primitives in the resulting factory the builder produces.

Parameters
provider:Provider

provider object for cryptographic primitives.

Returns:JcePublicKeyDataDecryptorFactoryBuilder

the current builder.

setProviderback to summary
public JcePublicKeyDataDecryptorFactoryBuilder setProvider(String providerName)

Set the provider name to use for creating cryptographic primitives in the resulting factory the builder produces.

Parameters
providerName:String

the name of the provider to reference for cryptographic primitives.

Returns:JcePublicKeyDataDecryptorFactoryBuilder

the current builder.

updateWithMPIback to summary
private void updateWithMPI(Cipher c, int expectedPayloadSize, byte[] encMPI)