Java Key Public getPublicKey(KeyStore keyStore, String alias)

Here you can find the source of getPublicKey(KeyStore keyStore, String alias)

Description

get Public Key

License

Open Source License

Declaration

public static PublicKey getPublicKey(KeyStore keyStore, String alias) 

Method Source Code

//package com.java2s;

import java.security.KeyStore;
import java.security.KeyStoreException;

import java.security.PublicKey;
import java.security.cert.Certificate;

public class Main {

    public static PublicKey getPublicKey(KeyStore keyStore, String alias) {
        return getCertificate(keyStore, alias).getPublicKey();
    }//from   w  w  w .j  a va2 s  .  co m

    public static Certificate getCertificate(KeyStore keyStore, String alias) {
        try {
            return keyStore.getCertificate(alias);
        } catch (KeyStoreException e) {
            throw new RuntimeException("get certificate error.", e);
        }
    }
}

Related

  1. getPublicKey(final byte[] modulus, final byte[] exponent)
  2. getPublicKey(final String algorithm, final File publicKeyFile)
  3. getPublicKey(KeyPair keyPair)
  4. getPublicKey(KeyPair keyPair)
  5. getPublicKey(KeyPair kp)
  6. getPublicKey(KeyStore keyStore, String alias)
  7. getPublicKey(KeyStore keyStore, String alias, char[] password)
  8. getPublicKey(KeyStore ks, String alias, char[] password)
  9. getPublicKey(String algo)