common.crypto.RSA Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unbound-java-provider Show documentation
Show all versions of unbound-java-provider Show documentation
This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi
package com.unbound.common.crypto;
import java.security.Signature;
import java.security.interfaces.RSAPrivateKey;
public final class RSA
{
public static byte[] signPkcs1(RSAPrivateKey key, String hashType, byte[] in)
{
try
{
Signature signature = SystemProvider.Signature.getInstance(hashType + "withRSA");
signature.initSign(key);
signature.update(in);
return signature.sign();
}
catch (Exception e) { throw new IllegalArgumentException(e); }
}
}