Java Key Public getPublicKey(BigInteger modulus, BigInteger exponent)

Here you can find the source of getPublicKey(BigInteger modulus, BigInteger exponent)

Description

get Public Key

License

Apache License

Declaration

public static RSAPublicKey getPublicKey(BigInteger modulus, BigInteger exponent)
            throws NoSuchAlgorithmException, InvalidKeySpecException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.math.BigInteger;

import java.security.*;

import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;

import java.security.spec.RSAPublicKeySpec;

public class Main {
    public static RSAPublicKey getPublicKey(BigInteger modulus, BigInteger exponent)
            throws NoSuchAlgorithmException, InvalidKeySpecException {
        KeyFactory keyFactory = KeyFactory.getInstance("RSA");
        RSAPublicKeySpec keySpec = new RSAPublicKeySpec(modulus, exponent);
        return (RSAPublicKey) keyFactory.generatePublic(keySpec);
    }/*from   w w  w  .j ava 2s  . co m*/
}

Related

  1. getPublicDeclaredMethods(Class clz)
  2. getPublicDeclaredMethods(Class clz)
  3. getPublicEncoded(KeyPair kp)
  4. getPublicExponent(PublicKey pubk)
  5. getPublicKey()
  6. getPublicKey(byte[] der)
  7. getPublicKey(byte[] keyBytes, String algorithm)
  8. getPublicKey(final byte[] keyData)
  9. getPublicKey(final byte[] modulus, final byte[] exponent)