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) throws KeyStoreException 

Method Source Code

//package com.java2s;
/*/*ww w .jav  a 2 s .  c  om*/
 * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * WSO2 Inc. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

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

public class Main {
    public static PublicKey getPublicKey(KeyStore keyStore, String alias) throws KeyStoreException {
        return keyStore.getCertificate(alias).getPublicKey();
    }
}

Related

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