public static PublicKey loadPublicKeyFromKeyStore(KeyStore keyStore,String alias,String keyPass){
        try {			
        	RSAPrivateCrtKey key = (RSAPrivateCrtKey) keyStore.getKey(alias, keyPass.toCharArray());
			RSAPublicKeySpec spec = new RSAPublicKeySpec(key.getModulus(),
					key.getPublicExponent());
			PublicKey publicKey = KeyFactory.getInstance(KEY_ALGORITHM).generatePublic(spec);
            return publicKey;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
public static PublicKey loadPublicKeyFromKeyStore ( KeyStore keyStore , String alias , String keyPass ) { try { RSAPrivateCrtKey key = ( RSAPrivateCrtKey ) keyStore . getKey ( alias , keyPass . toCharArray ( ) ) ; RSAPublicKeySpec spec = new RSAPublicKeySpec ( key . getModulus ( ) , key . getPublicExponent ( ) ) ; PublicKey publicKey = KeyFactory . getInstance ( KEY_ALGORITHM ) . generatePublic ( spec ) ; return publicKey ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
@param keyStore
@param alias
@param keyPass
@return