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-jdk14 Show documentation
Show all versions of bcprov-jdk14 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 JDK 1.4.
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;
}
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy