OCSP Verifier to check a given certificate





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I´m trying to implement an OCSP verifier to check if a given Certificate is still valid or already revoked. I have the following code



public class ValidateCertUseOCSP {

/*
* Filename that contains the root CA cert of the OCSP server's cert.
*/
private static final String ROOT_CA_CERT = "C:\Users\Computer\Desktop\DigiCertSHA2SecureServerCA_cert_out.pem";

/*
* Filename that contains the OCSP server's cert.
*/
private static final String OCSP_SERVER_CERT = "C:\Users\Computer\Desktop\gearbest_cert_out.pem";



/**
* Checks the revocation status of a public key certificate using OCSP.
*
* Usage: java ValidateCert <cert-file> [<OCSP-server>]
* <cert-file> is the filename of the certificate to be checked.
* The certificate must be in PEM format.
* <OCSP-server> is the URL of the OCSP server to use.
* If not supplied then the certificate must identify an OCSP
* server by means of its AuthorityInfoAccess extension.
* If supplied then it overrides any URL which may be present
* in the certificate's AuthorityInfoAccess extension.
*
* Example: java
* -Dhttp.proxyHost=proxy.example.net
* -Dhttp.proxyPort=8080
* ValidateCert
* mycert.pem
* http://ocsp.openvalidation.org:80
* @param args
*/
public static void main(String args) {

try {
CertPath cp = null;
Vector<X509Certificate> certs = new Vector<X509Certificate>();
URI ocspServer = null;



if (args.length == 0 || args.length > 2) {
System.out.println(
"Usage: java ValidateCert <cert-file> [<OCSP-server>]");
System.exit(-1);
}

// load the cert to be checked
certs.add(getCertFromFile(args[0]));


// handle location of OCSP server
if (args.length == 2) {
ocspServer = new URI(args[1]);
System.out.println("Using the OCSP server at: " + args[1]);
System.out.println("to check the revocation status of: " +
certs.elementAt(0));
System.out.println();
} else {
System.out.println("Using the OCSP server specified in the " +
"cert to check the revocation status of: " +
certs.elementAt(0));
System.out.println();
}

// init cert path
CertificateFactory cf = CertificateFactory.getInstance("X509");
cp = (CertPath)cf.generateCertPath(certs);

// load the root CA cert for the OCSP server cert
X509Certificate rootCACert = getCertFromFile(ROOT_CA_CERT);

// init trusted certs
TrustAnchor ta = new TrustAnchor(rootCACert, null);
Set trustedCertsSet = new HashSet();
trustedCertsSet.add(ta);

// init cert store
Set certSet = new HashSet();
X509Certificate ocspCert = getCertFromFile(OCSP_SERVER_CERT);
certSet.add(ocspCert);
CertStoreParameters storeParams =
new CollectionCertStoreParameters(certSet);
CertStore store = CertStore.getInstance("Collection", storeParams);

// init PKIX parameters
PKIXParameters params = null;
params = new PKIXParameters(trustedCertsSet);
params.addCertStore(store);

// enable OCSP
Security.setProperty("ocsp.enable", "true");
if (ocspServer != null) {
Security.setProperty("ocsp.responderURL", args[1]);
Security.setProperty("ocsp.responderCertSubjectName",
ocspCert.getSubjectX500Principal().getName());
}

// perform validation
CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
PKIXCertPathValidatorResult cpv_result =
(PKIXCertPathValidatorResult) cpv.validate(cp, params);
X509Certificate trustedCert = (X509Certificate)
cpv_result.getTrustAnchor().getTrustedCert();

if (trustedCert == null) {
System.out.println("Trsuted Cert = NULL");
} else {
System.out.println("Trusted CA DN = " +
trustedCert.getSubjectDN());
}

} catch (CertPathValidatorException e) {
e.printStackTrace();
System.exit(1);

} catch(Exception e) {
e.printStackTrace();
System.exit(-1);
}
System.out.println("CERTIFICATE VALIDATION SUCCEEDED");
System.exit(0);
}

/*
* Read a certificate from the specified filepath.
*/
private static X509Certificate getCertFromFile(String path) {
X509Certificate cert = null;
try {

File certFile = new File(path);
if (!certFile.canRead())
throw new IOException(" File " + certFile.toString() +
" is unreadable");

FileInputStream fis = new FileInputStream(path);
CertificateFactory cf = CertificateFactory.getInstance("X509");
cert = (X509Certificate)cf.generateCertificate(fis);

} catch(Exception e) {
System.out.println("Can't construct X509 Certificate. " +
e.getMessage());
}
return cert;
}


}



and when I run it it gives me the first error message:



run:



Usage: java ValidateCert <cert-file> [<OCSP-server>]
C:UsersComputerAppDataLocalNetBeansCache8.2executor-snippetsrun.xml:53:
Java returned: -1
BUILD FAILED (total time: 1 second)









share|improve this question




















  • 1





    @Kishan: computer output should be 'code' not blockquote, especially when it contains angle-bracketed items as this does. Also I don't think 'validation' is an improvement because certificate validation is almost completely unlike the validation(s) done elsewhere in progamming, but I left it since it does no harm and the formatting is much more important.

    – dave_thompson_085
    Nov 25 '18 at 7:07













  • John: you apparently ran it with either no arguments or too many, so you got the usage message and exit(-1). Exactly how did you run it? Are you using some IDE? If so you need to tell it what arguments to use on the run.

    – dave_thompson_085
    Nov 25 '18 at 7:08













  • @ dave_thompson_085 ok I ill take care of that next time i do an edit. Thank you .

    – Kishan C S
    Nov 25 '18 at 7:09











  • @dave_thompson_085 I´m using NetBeans,how can I tell what arguments I want to use in this case ? I want it to read the 2 Strings declared in the beggining, I´m not sure how to do it

    – John
    Nov 25 '18 at 17:48











  • If you mean read the files named by the values of the variables ROOT_CA_CERT and OCSP_SERVER_CERT the code already reads both of those, but the information needed as command argument(s) is different and is not either of those, but is stated in the usage message and described quite clearly in the comments in your(?) code.

    – dave_thompson_085
    Nov 27 '18 at 7:40


















0















I´m trying to implement an OCSP verifier to check if a given Certificate is still valid or already revoked. I have the following code



public class ValidateCertUseOCSP {

/*
* Filename that contains the root CA cert of the OCSP server's cert.
*/
private static final String ROOT_CA_CERT = "C:\Users\Computer\Desktop\DigiCertSHA2SecureServerCA_cert_out.pem";

/*
* Filename that contains the OCSP server's cert.
*/
private static final String OCSP_SERVER_CERT = "C:\Users\Computer\Desktop\gearbest_cert_out.pem";



/**
* Checks the revocation status of a public key certificate using OCSP.
*
* Usage: java ValidateCert <cert-file> [<OCSP-server>]
* <cert-file> is the filename of the certificate to be checked.
* The certificate must be in PEM format.
* <OCSP-server> is the URL of the OCSP server to use.
* If not supplied then the certificate must identify an OCSP
* server by means of its AuthorityInfoAccess extension.
* If supplied then it overrides any URL which may be present
* in the certificate's AuthorityInfoAccess extension.
*
* Example: java
* -Dhttp.proxyHost=proxy.example.net
* -Dhttp.proxyPort=8080
* ValidateCert
* mycert.pem
* http://ocsp.openvalidation.org:80
* @param args
*/
public static void main(String args) {

try {
CertPath cp = null;
Vector<X509Certificate> certs = new Vector<X509Certificate>();
URI ocspServer = null;



if (args.length == 0 || args.length > 2) {
System.out.println(
"Usage: java ValidateCert <cert-file> [<OCSP-server>]");
System.exit(-1);
}

// load the cert to be checked
certs.add(getCertFromFile(args[0]));


// handle location of OCSP server
if (args.length == 2) {
ocspServer = new URI(args[1]);
System.out.println("Using the OCSP server at: " + args[1]);
System.out.println("to check the revocation status of: " +
certs.elementAt(0));
System.out.println();
} else {
System.out.println("Using the OCSP server specified in the " +
"cert to check the revocation status of: " +
certs.elementAt(0));
System.out.println();
}

// init cert path
CertificateFactory cf = CertificateFactory.getInstance("X509");
cp = (CertPath)cf.generateCertPath(certs);

// load the root CA cert for the OCSP server cert
X509Certificate rootCACert = getCertFromFile(ROOT_CA_CERT);

// init trusted certs
TrustAnchor ta = new TrustAnchor(rootCACert, null);
Set trustedCertsSet = new HashSet();
trustedCertsSet.add(ta);

// init cert store
Set certSet = new HashSet();
X509Certificate ocspCert = getCertFromFile(OCSP_SERVER_CERT);
certSet.add(ocspCert);
CertStoreParameters storeParams =
new CollectionCertStoreParameters(certSet);
CertStore store = CertStore.getInstance("Collection", storeParams);

// init PKIX parameters
PKIXParameters params = null;
params = new PKIXParameters(trustedCertsSet);
params.addCertStore(store);

// enable OCSP
Security.setProperty("ocsp.enable", "true");
if (ocspServer != null) {
Security.setProperty("ocsp.responderURL", args[1]);
Security.setProperty("ocsp.responderCertSubjectName",
ocspCert.getSubjectX500Principal().getName());
}

// perform validation
CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
PKIXCertPathValidatorResult cpv_result =
(PKIXCertPathValidatorResult) cpv.validate(cp, params);
X509Certificate trustedCert = (X509Certificate)
cpv_result.getTrustAnchor().getTrustedCert();

if (trustedCert == null) {
System.out.println("Trsuted Cert = NULL");
} else {
System.out.println("Trusted CA DN = " +
trustedCert.getSubjectDN());
}

} catch (CertPathValidatorException e) {
e.printStackTrace();
System.exit(1);

} catch(Exception e) {
e.printStackTrace();
System.exit(-1);
}
System.out.println("CERTIFICATE VALIDATION SUCCEEDED");
System.exit(0);
}

/*
* Read a certificate from the specified filepath.
*/
private static X509Certificate getCertFromFile(String path) {
X509Certificate cert = null;
try {

File certFile = new File(path);
if (!certFile.canRead())
throw new IOException(" File " + certFile.toString() +
" is unreadable");

FileInputStream fis = new FileInputStream(path);
CertificateFactory cf = CertificateFactory.getInstance("X509");
cert = (X509Certificate)cf.generateCertificate(fis);

} catch(Exception e) {
System.out.println("Can't construct X509 Certificate. " +
e.getMessage());
}
return cert;
}


}



and when I run it it gives me the first error message:



run:



Usage: java ValidateCert <cert-file> [<OCSP-server>]
C:UsersComputerAppDataLocalNetBeansCache8.2executor-snippetsrun.xml:53:
Java returned: -1
BUILD FAILED (total time: 1 second)









share|improve this question




















  • 1





    @Kishan: computer output should be 'code' not blockquote, especially when it contains angle-bracketed items as this does. Also I don't think 'validation' is an improvement because certificate validation is almost completely unlike the validation(s) done elsewhere in progamming, but I left it since it does no harm and the formatting is much more important.

    – dave_thompson_085
    Nov 25 '18 at 7:07













  • John: you apparently ran it with either no arguments or too many, so you got the usage message and exit(-1). Exactly how did you run it? Are you using some IDE? If so you need to tell it what arguments to use on the run.

    – dave_thompson_085
    Nov 25 '18 at 7:08













  • @ dave_thompson_085 ok I ill take care of that next time i do an edit. Thank you .

    – Kishan C S
    Nov 25 '18 at 7:09











  • @dave_thompson_085 I´m using NetBeans,how can I tell what arguments I want to use in this case ? I want it to read the 2 Strings declared in the beggining, I´m not sure how to do it

    – John
    Nov 25 '18 at 17:48











  • If you mean read the files named by the values of the variables ROOT_CA_CERT and OCSP_SERVER_CERT the code already reads both of those, but the information needed as command argument(s) is different and is not either of those, but is stated in the usage message and described quite clearly in the comments in your(?) code.

    – dave_thompson_085
    Nov 27 '18 at 7:40














0












0








0








I´m trying to implement an OCSP verifier to check if a given Certificate is still valid or already revoked. I have the following code



public class ValidateCertUseOCSP {

/*
* Filename that contains the root CA cert of the OCSP server's cert.
*/
private static final String ROOT_CA_CERT = "C:\Users\Computer\Desktop\DigiCertSHA2SecureServerCA_cert_out.pem";

/*
* Filename that contains the OCSP server's cert.
*/
private static final String OCSP_SERVER_CERT = "C:\Users\Computer\Desktop\gearbest_cert_out.pem";



/**
* Checks the revocation status of a public key certificate using OCSP.
*
* Usage: java ValidateCert <cert-file> [<OCSP-server>]
* <cert-file> is the filename of the certificate to be checked.
* The certificate must be in PEM format.
* <OCSP-server> is the URL of the OCSP server to use.
* If not supplied then the certificate must identify an OCSP
* server by means of its AuthorityInfoAccess extension.
* If supplied then it overrides any URL which may be present
* in the certificate's AuthorityInfoAccess extension.
*
* Example: java
* -Dhttp.proxyHost=proxy.example.net
* -Dhttp.proxyPort=8080
* ValidateCert
* mycert.pem
* http://ocsp.openvalidation.org:80
* @param args
*/
public static void main(String args) {

try {
CertPath cp = null;
Vector<X509Certificate> certs = new Vector<X509Certificate>();
URI ocspServer = null;



if (args.length == 0 || args.length > 2) {
System.out.println(
"Usage: java ValidateCert <cert-file> [<OCSP-server>]");
System.exit(-1);
}

// load the cert to be checked
certs.add(getCertFromFile(args[0]));


// handle location of OCSP server
if (args.length == 2) {
ocspServer = new URI(args[1]);
System.out.println("Using the OCSP server at: " + args[1]);
System.out.println("to check the revocation status of: " +
certs.elementAt(0));
System.out.println();
} else {
System.out.println("Using the OCSP server specified in the " +
"cert to check the revocation status of: " +
certs.elementAt(0));
System.out.println();
}

// init cert path
CertificateFactory cf = CertificateFactory.getInstance("X509");
cp = (CertPath)cf.generateCertPath(certs);

// load the root CA cert for the OCSP server cert
X509Certificate rootCACert = getCertFromFile(ROOT_CA_CERT);

// init trusted certs
TrustAnchor ta = new TrustAnchor(rootCACert, null);
Set trustedCertsSet = new HashSet();
trustedCertsSet.add(ta);

// init cert store
Set certSet = new HashSet();
X509Certificate ocspCert = getCertFromFile(OCSP_SERVER_CERT);
certSet.add(ocspCert);
CertStoreParameters storeParams =
new CollectionCertStoreParameters(certSet);
CertStore store = CertStore.getInstance("Collection", storeParams);

// init PKIX parameters
PKIXParameters params = null;
params = new PKIXParameters(trustedCertsSet);
params.addCertStore(store);

// enable OCSP
Security.setProperty("ocsp.enable", "true");
if (ocspServer != null) {
Security.setProperty("ocsp.responderURL", args[1]);
Security.setProperty("ocsp.responderCertSubjectName",
ocspCert.getSubjectX500Principal().getName());
}

// perform validation
CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
PKIXCertPathValidatorResult cpv_result =
(PKIXCertPathValidatorResult) cpv.validate(cp, params);
X509Certificate trustedCert = (X509Certificate)
cpv_result.getTrustAnchor().getTrustedCert();

if (trustedCert == null) {
System.out.println("Trsuted Cert = NULL");
} else {
System.out.println("Trusted CA DN = " +
trustedCert.getSubjectDN());
}

} catch (CertPathValidatorException e) {
e.printStackTrace();
System.exit(1);

} catch(Exception e) {
e.printStackTrace();
System.exit(-1);
}
System.out.println("CERTIFICATE VALIDATION SUCCEEDED");
System.exit(0);
}

/*
* Read a certificate from the specified filepath.
*/
private static X509Certificate getCertFromFile(String path) {
X509Certificate cert = null;
try {

File certFile = new File(path);
if (!certFile.canRead())
throw new IOException(" File " + certFile.toString() +
" is unreadable");

FileInputStream fis = new FileInputStream(path);
CertificateFactory cf = CertificateFactory.getInstance("X509");
cert = (X509Certificate)cf.generateCertificate(fis);

} catch(Exception e) {
System.out.println("Can't construct X509 Certificate. " +
e.getMessage());
}
return cert;
}


}



and when I run it it gives me the first error message:



run:



Usage: java ValidateCert <cert-file> [<OCSP-server>]
C:UsersComputerAppDataLocalNetBeansCache8.2executor-snippetsrun.xml:53:
Java returned: -1
BUILD FAILED (total time: 1 second)









share|improve this question
















I´m trying to implement an OCSP verifier to check if a given Certificate is still valid or already revoked. I have the following code



public class ValidateCertUseOCSP {

/*
* Filename that contains the root CA cert of the OCSP server's cert.
*/
private static final String ROOT_CA_CERT = "C:\Users\Computer\Desktop\DigiCertSHA2SecureServerCA_cert_out.pem";

/*
* Filename that contains the OCSP server's cert.
*/
private static final String OCSP_SERVER_CERT = "C:\Users\Computer\Desktop\gearbest_cert_out.pem";



/**
* Checks the revocation status of a public key certificate using OCSP.
*
* Usage: java ValidateCert <cert-file> [<OCSP-server>]
* <cert-file> is the filename of the certificate to be checked.
* The certificate must be in PEM format.
* <OCSP-server> is the URL of the OCSP server to use.
* If not supplied then the certificate must identify an OCSP
* server by means of its AuthorityInfoAccess extension.
* If supplied then it overrides any URL which may be present
* in the certificate's AuthorityInfoAccess extension.
*
* Example: java
* -Dhttp.proxyHost=proxy.example.net
* -Dhttp.proxyPort=8080
* ValidateCert
* mycert.pem
* http://ocsp.openvalidation.org:80
* @param args
*/
public static void main(String args) {

try {
CertPath cp = null;
Vector<X509Certificate> certs = new Vector<X509Certificate>();
URI ocspServer = null;



if (args.length == 0 || args.length > 2) {
System.out.println(
"Usage: java ValidateCert <cert-file> [<OCSP-server>]");
System.exit(-1);
}

// load the cert to be checked
certs.add(getCertFromFile(args[0]));


// handle location of OCSP server
if (args.length == 2) {
ocspServer = new URI(args[1]);
System.out.println("Using the OCSP server at: " + args[1]);
System.out.println("to check the revocation status of: " +
certs.elementAt(0));
System.out.println();
} else {
System.out.println("Using the OCSP server specified in the " +
"cert to check the revocation status of: " +
certs.elementAt(0));
System.out.println();
}

// init cert path
CertificateFactory cf = CertificateFactory.getInstance("X509");
cp = (CertPath)cf.generateCertPath(certs);

// load the root CA cert for the OCSP server cert
X509Certificate rootCACert = getCertFromFile(ROOT_CA_CERT);

// init trusted certs
TrustAnchor ta = new TrustAnchor(rootCACert, null);
Set trustedCertsSet = new HashSet();
trustedCertsSet.add(ta);

// init cert store
Set certSet = new HashSet();
X509Certificate ocspCert = getCertFromFile(OCSP_SERVER_CERT);
certSet.add(ocspCert);
CertStoreParameters storeParams =
new CollectionCertStoreParameters(certSet);
CertStore store = CertStore.getInstance("Collection", storeParams);

// init PKIX parameters
PKIXParameters params = null;
params = new PKIXParameters(trustedCertsSet);
params.addCertStore(store);

// enable OCSP
Security.setProperty("ocsp.enable", "true");
if (ocspServer != null) {
Security.setProperty("ocsp.responderURL", args[1]);
Security.setProperty("ocsp.responderCertSubjectName",
ocspCert.getSubjectX500Principal().getName());
}

// perform validation
CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
PKIXCertPathValidatorResult cpv_result =
(PKIXCertPathValidatorResult) cpv.validate(cp, params);
X509Certificate trustedCert = (X509Certificate)
cpv_result.getTrustAnchor().getTrustedCert();

if (trustedCert == null) {
System.out.println("Trsuted Cert = NULL");
} else {
System.out.println("Trusted CA DN = " +
trustedCert.getSubjectDN());
}

} catch (CertPathValidatorException e) {
e.printStackTrace();
System.exit(1);

} catch(Exception e) {
e.printStackTrace();
System.exit(-1);
}
System.out.println("CERTIFICATE VALIDATION SUCCEEDED");
System.exit(0);
}

/*
* Read a certificate from the specified filepath.
*/
private static X509Certificate getCertFromFile(String path) {
X509Certificate cert = null;
try {

File certFile = new File(path);
if (!certFile.canRead())
throw new IOException(" File " + certFile.toString() +
" is unreadable");

FileInputStream fis = new FileInputStream(path);
CertificateFactory cf = CertificateFactory.getInstance("X509");
cert = (X509Certificate)cf.generateCertificate(fis);

} catch(Exception e) {
System.out.println("Can't construct X509 Certificate. " +
e.getMessage());
}
return cert;
}


}



and when I run it it gives me the first error message:



run:



Usage: java ValidateCert <cert-file> [<OCSP-server>]
C:UsersComputerAppDataLocalNetBeansCache8.2executor-snippetsrun.xml:53:
Java returned: -1
BUILD FAILED (total time: 1 second)






java validation certificate ocsp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 7:04









dave_thompson_085

14.1k11733




14.1k11733










asked Nov 25 '18 at 1:51









JohnJohn

1




1








  • 1





    @Kishan: computer output should be 'code' not blockquote, especially when it contains angle-bracketed items as this does. Also I don't think 'validation' is an improvement because certificate validation is almost completely unlike the validation(s) done elsewhere in progamming, but I left it since it does no harm and the formatting is much more important.

    – dave_thompson_085
    Nov 25 '18 at 7:07













  • John: you apparently ran it with either no arguments or too many, so you got the usage message and exit(-1). Exactly how did you run it? Are you using some IDE? If so you need to tell it what arguments to use on the run.

    – dave_thompson_085
    Nov 25 '18 at 7:08













  • @ dave_thompson_085 ok I ill take care of that next time i do an edit. Thank you .

    – Kishan C S
    Nov 25 '18 at 7:09











  • @dave_thompson_085 I´m using NetBeans,how can I tell what arguments I want to use in this case ? I want it to read the 2 Strings declared in the beggining, I´m not sure how to do it

    – John
    Nov 25 '18 at 17:48











  • If you mean read the files named by the values of the variables ROOT_CA_CERT and OCSP_SERVER_CERT the code already reads both of those, but the information needed as command argument(s) is different and is not either of those, but is stated in the usage message and described quite clearly in the comments in your(?) code.

    – dave_thompson_085
    Nov 27 '18 at 7:40














  • 1





    @Kishan: computer output should be 'code' not blockquote, especially when it contains angle-bracketed items as this does. Also I don't think 'validation' is an improvement because certificate validation is almost completely unlike the validation(s) done elsewhere in progamming, but I left it since it does no harm and the formatting is much more important.

    – dave_thompson_085
    Nov 25 '18 at 7:07













  • John: you apparently ran it with either no arguments or too many, so you got the usage message and exit(-1). Exactly how did you run it? Are you using some IDE? If so you need to tell it what arguments to use on the run.

    – dave_thompson_085
    Nov 25 '18 at 7:08













  • @ dave_thompson_085 ok I ill take care of that next time i do an edit. Thank you .

    – Kishan C S
    Nov 25 '18 at 7:09











  • @dave_thompson_085 I´m using NetBeans,how can I tell what arguments I want to use in this case ? I want it to read the 2 Strings declared in the beggining, I´m not sure how to do it

    – John
    Nov 25 '18 at 17:48











  • If you mean read the files named by the values of the variables ROOT_CA_CERT and OCSP_SERVER_CERT the code already reads both of those, but the information needed as command argument(s) is different and is not either of those, but is stated in the usage message and described quite clearly in the comments in your(?) code.

    – dave_thompson_085
    Nov 27 '18 at 7:40








1




1





@Kishan: computer output should be 'code' not blockquote, especially when it contains angle-bracketed items as this does. Also I don't think 'validation' is an improvement because certificate validation is almost completely unlike the validation(s) done elsewhere in progamming, but I left it since it does no harm and the formatting is much more important.

– dave_thompson_085
Nov 25 '18 at 7:07







@Kishan: computer output should be 'code' not blockquote, especially when it contains angle-bracketed items as this does. Also I don't think 'validation' is an improvement because certificate validation is almost completely unlike the validation(s) done elsewhere in progamming, but I left it since it does no harm and the formatting is much more important.

– dave_thompson_085
Nov 25 '18 at 7:07















John: you apparently ran it with either no arguments or too many, so you got the usage message and exit(-1). Exactly how did you run it? Are you using some IDE? If so you need to tell it what arguments to use on the run.

– dave_thompson_085
Nov 25 '18 at 7:08







John: you apparently ran it with either no arguments or too many, so you got the usage message and exit(-1). Exactly how did you run it? Are you using some IDE? If so you need to tell it what arguments to use on the run.

– dave_thompson_085
Nov 25 '18 at 7:08















@ dave_thompson_085 ok I ill take care of that next time i do an edit. Thank you .

– Kishan C S
Nov 25 '18 at 7:09





@ dave_thompson_085 ok I ill take care of that next time i do an edit. Thank you .

– Kishan C S
Nov 25 '18 at 7:09













@dave_thompson_085 I´m using NetBeans,how can I tell what arguments I want to use in this case ? I want it to read the 2 Strings declared in the beggining, I´m not sure how to do it

– John
Nov 25 '18 at 17:48





@dave_thompson_085 I´m using NetBeans,how can I tell what arguments I want to use in this case ? I want it to read the 2 Strings declared in the beggining, I´m not sure how to do it

– John
Nov 25 '18 at 17:48













If you mean read the files named by the values of the variables ROOT_CA_CERT and OCSP_SERVER_CERT the code already reads both of those, but the information needed as command argument(s) is different and is not either of those, but is stated in the usage message and described quite clearly in the comments in your(?) code.

– dave_thompson_085
Nov 27 '18 at 7:40





If you mean read the files named by the values of the variables ROOT_CA_CERT and OCSP_SERVER_CERT the code already reads both of those, but the information needed as command argument(s) is different and is not either of those, but is stated in the usage message and described quite clearly in the comments in your(?) code.

– dave_thompson_085
Nov 27 '18 at 7:40












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53464006%2focsp-verifier-to-check-a-given-certificate%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53464006%2focsp-verifier-to-check-a-given-certificate%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini