Android Utililty Methods Certificate Create

List of utility methods to do Certificate Create

Description

The list of methods to do Certificate Create are organized into topic(s).

Method

StringgetCertificate()
get Certificate
return serverCertificate;
CertificateFactorycreateX509CertificateFactory(String provider)
create X Certificate Factory
if (provider == null) {
    return CertificateFactory.getInstance("X.509");
return CertificateFactory.getInstance("X.509", provider);
X509CertificategenerateX509CertificateFromSignature( 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;
booleanverifySignature(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);