code: public static PublicKey loadPublicKeyFromCert(String certPath) throws CertificateException, FileNotFoundException {
      	try {			
      		CertificateFactory cf = CertificateFactory.getInstance("X.509");
      		FileInputStream in = new FileInputStream(certPath);
      		Certificate crt = cf.generateCertificate(in);
      		PublicKey publicKey = crt.getPublicKey();
      		return publicKey;
  		} catch (CertificateException e) {
  			throw new RuntimeException(e);
  		}catch (FileNotFoundException e) {
  			throw new RuntimeException("文件不存在");
  		}
  	}
docs: 从证书文件获取公钥
  @param certPath
  @return
  @throws CertificateException
  @throws FileNotFoundException