org.bouncycastle.pqc.jcajce.provider.util.SpecUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-ext-debug-jdk18on Show documentation
Show all versions of bcprov-ext-debug-jdk18on Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for Java 1.8 and later with debug enabled.
The newest version!
package org.bouncycastle.pqc.jcajce.provider.util;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.spec.AlgorithmParameterSpec;
public class SpecUtil
{
private static Class[] NO_PARAMS = new Class[0];
private static Object[] NO_ARGS = new Object[0];
public static String getNameFrom(final AlgorithmParameterSpec paramSpec)
{
return (String)AccessController.doPrivileged(new PrivilegedAction()
{
public Object run()
{
try
{
Method m = paramSpec.getClass().getMethod("getName", NO_PARAMS);
return m.invoke(paramSpec, NO_ARGS);
}
catch (Exception e)
{
// ignore - maybe log?
}
return null;
}
});
}
}