Top Description Fields Constructors Methods
org.bouncycastle.jcajce.provider.asymmetric.compositesignatures

public Class KeyFactorySpi

extends BaseKeyFactorySpi
implements AsymmetricKeyInfoConverter
Class Inheritance
All Implemented Interfaces
org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter
Imports
java.io.IOException, java.security.GeneralSecurityException, .InvalidKeyException, .Key, .KeyFactory, .NoSuchAlgorithmException, .NoSuchProviderException, .PrivateKey, .PublicKey, java.security.spec.PKCS8EncodedKeySpec, .X509EncodedKeySpec, java.util.ArrayList, .Collections, .HashMap, .List, .Map, org.bouncycastle.asn1.ASN1BitString, .ASN1Encodable, .ASN1EncodableVector, .ASN1ObjectIdentifier, .ASN1OctetString, .ASN1Sequence, .DERBitString, .DEROctetString, .DERSequence, org.bouncycastle.asn1.bc.BCObjectIdentifiers, org.bouncycastle.asn1.nist.NISTObjectIdentifiers, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, .PrivateKeyInfo, org.bouncycastle.asn1.sec.SECObjectIdentifiers, org.bouncycastle.asn1.teletrust.TeleTrusTObjectIdentifiers, org.bouncycastle.asn1.util.ASN1Dump, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .SubjectPublicKeyInfo, org.bouncycastle.asn1.x9.X962Parameters, .X9ObjectIdentifiers, org.bouncycastle.internal.asn1.edec.EdECObjectIdentifiers, org.bouncycastle.internal.asn1.misc.MiscObjectIdentifiers, org.bouncycastle.jcajce.CompositePrivateKey, .CompositePublicKey, org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi, org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter, org.bouncycastle.jcajce.util.BCJcaJceHelper, .JcaJceHelper, org.bouncycastle.math.ec.rfc8032.Ed25519, .Ed448, org.bouncycastle.util.Arrays, .Exceptions

KeyFactory for composite signatures. List of supported combinations is in CompositeSignaturesConstants

Field Summary

Modifier and TypeField and Description
private static Map<ASN1ObjectIdentifier, int[]>
private static final AlgorithmIdentifier
private static final AlgorithmIdentifier
private static final AlgorithmIdentifier
private static final AlgorithmIdentifier
private static final AlgorithmIdentifier
private static final AlgorithmIdentifier
private static final AlgorithmIdentifier
private JcaJceHelper
private static final AlgorithmIdentifier
private static final AlgorithmIdentifier
private static final AlgorithmIdentifier
private static Map<ASN1ObjectIdentifier, AlgorithmIdentifier[]>
private static final AlgorithmIdentifier

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected Key
engineTranslateKey(Key
the key whose provider is unknown or untrusted.
key
)

Implements abstract java.security.KeyFactorySpi.engineTranslateKey.

Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.

public PrivateKey

Returns:

A CompositePrivateKey created from all components in the sequence.
generatePrivate
(PrivateKeyInfo
PrivateKeyInfo containing a sequence of PrivateKeyInfos corresponding to each component.
keyInfo
)

Implements org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter.generatePrivate.

Creates a CompositePrivateKey from its PrivateKeyInfo encoded form.

public PublicKey
generatePublic(SubjectPublicKeyInfo
SubjectPublicKeyInfo containing a sequence of BIT STRINGs corresponding to each component.
keyInfo
)

Implements org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter.generatePublic.

Creates a CompositePublicKey from its SubjectPublicKeyInfo encoded form.

private List<KeyFactory>

Returns:

A list of KeyFactories ordered by the composite signature definition.
getKeyFactoriesFromIdentifier
(ASN1ObjectIdentifier
OID of a composite signature.
algorithmIdentifier
)

A helper method that returns a list of KeyFactory objects based on the composite signature OID.

private X509EncodedKeySpec[]

Returns:

An array of X509EncodedKeySpecs
getKeysSpecs
(ASN1ObjectIdentifier
OID of a composite signature.
algorithmIdentifier
,
ASN1BitString[]
A BIT STRING array containing encoded component SubjectPublicKeyInfos.
subjectPublicKeys
)

A helper method that returns an array of X509EncodedKeySpecs based on the composite signature OID and the content of provided BIT STRINGs in subjectPublicKeys

pack-priv byte[][]
split(ASN1ObjectIdentifier algorithm, ASN1BitString publicKeyData)

Inherited from org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi:
engineGeneratePrivateengineGeneratePublicengineGetKeySpec

Field Detail

componentKeySizesback to summary
private static Map<ASN1ObjectIdentifier, int[]> componentKeySizes
ecDsaBrainpoolP256r1back to summary
private static final AlgorithmIdentifier ecDsaBrainpoolP256r1
ecDsaBrainpoolP384r1back to summary
private static final AlgorithmIdentifier ecDsaBrainpoolP384r1
ecDsaP256back to summary
private static final AlgorithmIdentifier ecDsaP256
ecDsaP384back to summary
private static final AlgorithmIdentifier ecDsaP384
ed25519back to summary
private static final AlgorithmIdentifier ed25519
ed448back to summary
private static final AlgorithmIdentifier ed448
falcon512Identifierback to summary
private static final AlgorithmIdentifier falcon512Identifier
helperback to summary
private JcaJceHelper helper
mlDsa44back to summary
private static final AlgorithmIdentifier mlDsa44
mlDsa65back to summary
private static final AlgorithmIdentifier mlDsa65
mlDsa87back to summary
private static final AlgorithmIdentifier mlDsa87
pairingsback to summary
private static Map<ASN1ObjectIdentifier, AlgorithmIdentifier[]> pairings
rsaback to summary
private static final AlgorithmIdentifier rsa

Constructor Detail

KeyFactorySpiback to summary
public KeyFactorySpi()
KeyFactorySpiback to summary
public KeyFactorySpi(JcaJceHelper helper)

Method Detail

engineTranslateKeyback to summary
protected Key engineTranslateKey(Key key) throws InvalidKeyException

Implements abstract java.security.KeyFactorySpi.engineTranslateKey.

Doc from java.security.KeyFactorySpi.engineTranslateKey.

Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this key factory.

Parameters
key:Key

the key whose provider is unknown or untrusted.

Returns:Key

the translated key.

Exceptions
InvalidKeyException:
if the given key cannot be processed by this key factory.
generatePrivateback to summary
public PrivateKey generatePrivate(PrivateKeyInfo keyInfo) throws IOException

Implements org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter.generatePrivate.

Creates a CompositePrivateKey from its PrivateKeyInfo encoded form. It is compliant with https://www.ietf.org/archive/id/draft-ounsworth-pq-composite-sigs-13.html where CompositeSignaturePrivateKey is a sequence of two OneAsymmetricKey which a newer name for PrivateKeyInfo.

Parameters
keyInfo:PrivateKeyInfo

PrivateKeyInfo containing a sequence of PrivateKeyInfos corresponding to each component.

Returns:PrivateKey

A CompositePrivateKey created from all components in the sequence.

generatePublicback to summary
public PublicKey generatePublic(SubjectPublicKeyInfo keyInfo) throws IOException

Implements org.bouncycastle.jcajce.provider.util.AsymmetricKeyInfoConverter.generatePublic.

Creates a CompositePublicKey from its SubjectPublicKeyInfo encoded form. It is compliant with https://www.ietf.org/archive/id/draft-ounsworth-pq-composite-sigs-13.html where CompositeSignaturePublicKey is a sequence of two BIT STRINGs which contain the encoded component public keys. In BC implementation - CompositePublicKey is encoded into a BIT STRING in the form of SubjectPublicKeyInfo.

Parameters
keyInfo:SubjectPublicKeyInfo

SubjectPublicKeyInfo containing a sequence of BIT STRINGs corresponding to each component.

getKeyFactoriesFromIdentifierback to summary
private List<KeyFactory> getKeyFactoriesFromIdentifier(ASN1ObjectIdentifier algorithmIdentifier) throws NoSuchAlgorithmException, NoSuchProviderException

A helper method that returns a list of KeyFactory objects based on the composite signature OID.

Parameters
algorithmIdentifier:ASN1ObjectIdentifier

OID of a composite signature.

Returns:List<KeyFactory>

A list of KeyFactories ordered by the composite signature definition.

getKeysSpecsback to summary
private X509EncodedKeySpec[] getKeysSpecs(ASN1ObjectIdentifier algorithmIdentifier, ASN1BitString[] subjectPublicKeys) throws IOException

A helper method that returns an array of X509EncodedKeySpecs based on the composite signature OID and the content of provided BIT STRINGs in subjectPublicKeys

Parameters
algorithmIdentifier:ASN1ObjectIdentifier

OID of a composite signature.

subjectPublicKeys:ASN1BitString[]

A BIT STRING array containing encoded component SubjectPublicKeyInfos.

Returns:X509EncodedKeySpec[]

An array of X509EncodedKeySpecs

splitback to summary
pack-priv byte[][] split(ASN1ObjectIdentifier algorithm, ASN1BitString publicKeyData)