com.unbound.client.SignatureMode 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.client;
import com.dyadicsec.cryptoki.CK;
import com.unbound.kmip.KMIP;
public final class SignatureMode
{
private final Integer kmipSigAlg;
private final Integer kmipPadding;
private final int pkcs11Mech;
private SignatureMode(Integer kmipSigAlg, Integer kmipPadding, int pkcs11Mech)
{
this.kmipSigAlg = kmipSigAlg;
this.kmipPadding = kmipPadding;
this.pkcs11Mech = pkcs11Mech;
}
public static SignatureMode RSA_PKCS1 = new SignatureMode(null, KMIP.PaddingMethod.PKCS1_V1_5, CK.CKM_RSA_PKCS);
public static SignatureMode RSA_PSS = new SignatureMode(KMIP.DigitalSignatureAlgorithm.RSASSA_PSS, KMIP.PaddingMethod.PSS, CK.CKM_RSA_PKCS_PSS);
public static SignatureMode ECDSA = new SignatureMode(null, null, CK.CKM_ECDSA);
public static SignatureMode EDDSA = new SignatureMode(null, null, CK.DYCKM_EDDSA);
public static SignatureMode Schnorr = new SignatureMode(null, null, CK.DYCKM_SCHNORR);
public int getPkcs11Mech() { return pkcs11Mech; }
public Integer getKmipPadding() { return kmipPadding; }
public Integer getKmipSigAlg(HashType hashType)
{
if (this==EDDSA) return null;
if (this==Schnorr) return null;
if (this==RSA_PKCS1) return hashType==null ? null : hashType.getKmipSigRsa();
if (this==ECDSA) return hashType==null ? null : hashType.getKmipSigEcdsa();
return kmipSigAlg;
}
}