In Java I use the following method to get the public key:
public PublicKey getPublicKey(InputStream in) { try { try { CertificateFactory certificateFactory = CertificateFactory .getInstance("X.509"); Certificate certificate = certificateFactory.generateCertificate(in); return certificate.getPublicKey(); } finally { if (in != null) in.close(); } } catch (Exception e) { throw new RuntimeException("init exception", e); } }
Here is a file stream,What should I do,thanks
In Java I use the following method to get the public key:
public PublicKey getPublicKey(InputStream in) { try { try { CertificateFactory certificateFactory = CertificateFactory .getInstance("X.509"); Certificate certificate = certificateFactory.generateCertificate(in); return certificate.getPublicKey(); } finally { if (in != null) in.close(); } } catch (Exception e) { throw new RuntimeException("init exception", e); } }
Here is a file stream,What should I do,thanks