List of utility methods to do Certificate Create
String | getCertificate() get Certificate return serverCertificate;
|
CertificateFactory | createX509CertificateFactory(String provider) create X Certificate Factory if (provider == null) { return CertificateFactory.getInstance("X.509"); return CertificateFactory.getInstance("X.509", provider); |
X509Certificate | generateX509CertificateFromSignature( final Signature signature) generate X Certificate From Signature CertificateFactory certificateFactory = CertificateFactory .getInstance("X.509"); ByteArrayInputStream inputStream = new ByteArrayInputStream( signature.toByteArray()); X509Certificate certificate = (X509Certificate) certificateFactory .generateCertificate(inputStream); return certificate; |
boolean | verifySignature(String algorithm, Certificate cert, byte[] signature, InputStream stream) Verify a signature of a stream. Signature sign; try { sign = Signature.getInstance(algorithm); } catch (NoSuchAlgorithmException badsigner) { throw new IOException( "Could not initialize signer with algorithm " + algorithm); sign.initVerify(cert); byte[] buffer = new byte[1024]; while (true) { int read = stream.read(buffer); if (read < 0) { break; sign.update(buffer, 0, read); return sign.verify(signature); |