Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.security.KeyStore;

import java.security.PublicKey;

public class Main {
    public static PublicKey androidPubKey(KeyStore keyStore, String alias) {
        try {
            KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(alias, null);
            return privateKeyEntry.getCertificate().getPublicKey();
        } catch (Exception expt) {
            expt.printStackTrace();
            throw new RuntimeException(expt);
        }
    }
}