All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.unbound.provider.UBRSAPublicKey Maven / Gradle / Ivy

Go to download

This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi

There is a newer version: 42761
Show newest version
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());
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy