com.unbound.provider.UBRSAPublicKey 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.provider;
import com.unbound.client.RSAPublicKeyObject;
import com.unbound.common.crypto.RSA;
import java.math.BigInteger;
import java.security.ProviderException;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
public final class UBRSAPublicKey implements RSAPublicKey
{
final RSAPublicKeyObject object;
UBRSAPublicKey(RSAPublicKeyObject object) { this.object = object; }
@Override
public BigInteger getPublicExponent() { return object.getPublicExponent(); }
@Override
public BigInteger getModulus() { return object.getModulus(); }
@Override
public String getAlgorithm() { return "RSA"; }
@Override
public String getFormat() { return "X.509"; }
@Override
public byte[] getEncoded()
{
return getPublicKey().getEncoded();
}
RSAPublicKey getPublicKey()
{
return RSA.newPublicKey(getModulus(), getPublicExponent());
}
}