Class ECUtil
java.lang.Object
org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil
utility class for converting jce/jca ECDSA, ECDH, and ECDHC
objects into their org.bouncycastle.crypto counterparts.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateKeyFingerprint(ECPoint publicPoint, ECParameterSpec spec) static AsymmetricKeyParameterstatic AsymmetricKeyParameterstatic Stringstatic ECDomainParametersgetDomainParameters(ProviderConfiguration configuration, X962Parameters params) static ECDomainParametersgetDomainParameters(ProviderConfiguration configuration, ECParameterSpec params) static X9ECParametersgetNamedCurveByName(String curveName) static X9ECParametersstatic ASN1ObjectIdentifiergetNamedCurveOid(String curveName) static ASN1ObjectIdentifiergetNamedCurveOid(ECParameterSpec ecParameterSpec) static StringgetNameFrom(AlgorithmParameterSpec paramSpec) static intgetOrderBitLength(ProviderConfiguration configuration, BigInteger order, BigInteger privateValue) static byte[]getUncompressedSubjectPublicKeyBytes(SubjectPublicKeyInfo spki, ProviderConfiguration configuration) Return thesubjectPublicKeybytes of a SubjectPublicKeyInfo with an EC point normalised to its uncompressed encoding, and the bytes of any other key type unchanged.static intprivateKeyHashCode(BigInteger d, ECParameterSpec spec) Hash code for an EC private scalar derived from the public point and domain parameters.static StringprivateKeyToString(String algorithm, BigInteger d, ECParameterSpec spec) static StringpublicKeyToString(String algorithm, ECPoint q, ECParameterSpec spec)
-
Constructor Details
-
ECUtil
public ECUtil()
-
-
Method Details
-
getDomainParameters
public static ECDomainParameters getDomainParameters(ProviderConfiguration configuration, ECParameterSpec params) -
getDomainParameters
public static ECDomainParameters getDomainParameters(ProviderConfiguration configuration, X962Parameters params) -
generatePublicKeyParameter
public static AsymmetricKeyParameter generatePublicKeyParameter(PublicKey key) throws InvalidKeyException - Throws:
InvalidKeyException
-
generatePrivateKeyParameter
public static AsymmetricKeyParameter generatePrivateKeyParameter(PrivateKey key) throws InvalidKeyException - Throws:
InvalidKeyException
-
getOrderBitLength
public static int getOrderBitLength(ProviderConfiguration configuration, BigInteger order, BigInteger privateValue) -
getNamedCurveOid
-
getNamedCurveOid
-
getUncompressedSubjectPublicKeyBytes
public static byte[] getUncompressedSubjectPublicKeyBytes(SubjectPublicKeyInfo spki, ProviderConfiguration configuration) Return thesubjectPublicKeybytes of a SubjectPublicKeyInfo with an EC point normalised to its uncompressed encoding, and the bytes of any other key type unchanged.The composite drafts (draft-ietf-lamps-pq-composite-sigs / -kem sec. 4) require an EC component to be carried as an uncompressed point, so a component key that would encode itself compressed - a BC EC key whose point format has been set through
ECPointEncoder, or a key from a provider that preserves a compressed encoding - has to be normalised on the way out rather than passed through as it came. This is a write-side normalisation only: a compressed component is still accepted on decode, as the component key factories decode either form.- Parameters:
spki- the key to take the component bytes from.configuration- provider configuration, consulted only for implicitlyCA and additional curve parameters.- Returns:
- the component key bytes, uncompressed if they are an EC point.
-
getNamedCurveByOid
-
getNamedCurveByName
-
getCurveName
-
privateKeyToString
-
publicKeyToString
-
generateKeyFingerprint
-
getNameFrom
-
privateKeyHashCode
Hash code for an EC private scalar derived from the public point and domain parameters.
-