Class ChaCha20SpecUtil
java.lang.Object
org.bouncycastle.jcajce.provider.symmetric.util.ChaCha20SpecUtil
Converts the JDK's
javax.crypto.spec.ChaCha20ParameterSpec (Java 11 and later) into the BC equivalent,
BCChaCha20ParameterSpec, so the provider only has to handle the BC type.
This copy works by reflection, so it compiles for any Java version and finds the JDK class wherever the runtime has it - including from the legacy distributions, which carry no multi-release overlays. The jdk1.11 copy uses the class directly. The two copies must keep the same public members: a caller compiled against this one is paired at runtime with whichever copy the JVM loads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BCChaCha20ParameterSpectoBCChaCha20Spec(AlgorithmParameterSpec paramSpec) Convert ajavax.crypto.spec.ChaCha20ParameterSpecinto the BC equivalent.
-
Constructor Details
-
ChaCha20SpecUtil
public ChaCha20SpecUtil()
-
-
Method Details
-
toBCChaCha20Spec
public static BCChaCha20ParameterSpec toBCChaCha20Spec(AlgorithmParameterSpec paramSpec) throws InvalidAlgorithmParameterException Convert ajavax.crypto.spec.ChaCha20ParameterSpecinto the BC equivalent.- Parameters:
paramSpec- the parameter spec to convert, may be null.- Returns:
- the equivalent
BCChaCha20ParameterSpec, or null if paramSpec is not ajavax.crypto.spec.ChaCha20ParameterSpec. - Throws:
InvalidAlgorithmParameterException- if paramSpec is one, but its values cannot be read.
-