Java Key Public getPublicKey(final byte[] keyData)

Here you can find the source of getPublicKey(final byte[] keyData)

Description

get Public Key

License

Apache License

Declaration

private static PublicKey getPublicKey(final byte[] keyData)
        throws GeneralSecurityException 

Method Source Code

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

import java.security.GeneralSecurityException;

import java.security.KeyFactory;

import java.security.PublicKey;

import java.security.spec.X509EncodedKeySpec;

public class Main {

    private static PublicKey getPublicKey(final byte[] keyData)
            throws GeneralSecurityException {
        final X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyData);
        final KeyFactory keyFactory = KeyFactory.getInstance("RSA");
        return keyFactory.generatePublic(keySpec);
    }/*  w  ww.j a  va 2s.  c  o m*/
}

Related

  1. getPublicExponent(PublicKey pubk)
  2. getPublicKey()
  3. getPublicKey(BigInteger modulus, BigInteger exponent)
  4. getPublicKey(byte[] der)
  5. getPublicKey(byte[] keyBytes, String algorithm)
  6. getPublicKey(final byte[] modulus, final byte[] exponent)
  7. getPublicKey(final String algorithm, final File publicKeyFile)
  8. getPublicKey(KeyPair keyPair)
  9. getPublicKey(KeyPair keyPair)