Java Code Examples for sun.security.validator.Validator#getInstance()
The following examples show how to use
sun.security.validator.Validator#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CertReplace.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 2
Source File: CertReplace.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 3
Source File: CertReplace.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 4
Source File: CertReplace.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 5
Source File: CertReplace.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 6
Source File: CertReplace.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 7
Source File: CertReplace.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 8
Source File: CertReplace.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 9
Source File: CertReplace.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 10
Source File: CertReplace.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 11
Source File: CertReplace.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 12
Source File: CertReplace.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 13
Source File: CertReplace.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * @param args {cacerts keystore, cert chain} */ public static void main(String[] args) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(args[0]), "changeit".toCharArray()); Validator v = Validator.getInstance (Validator.TYPE_PKIX, Validator.VAR_GENERIC, ks); X509Certificate[] chain = createPath(args[1]); System.out.println("Chain: "); for (X509Certificate c: v.validate(chain)) { System.out.println(" " + c.getSubjectX500Principal() + " issued by " + c.getIssuerX500Principal()); } }
Example 14
Source File: ConstructorTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void testCtorByPKIXBuilderParams(Set<X509Certificate> certSet) throws Exception { Set<TrustAnchor> taSet = makeTrustAnchorSet(certSet); Validator valOK; Validator valNoGood; X509Certificate[] chain = new X509Certificate[1]; Set<X509Certificate> intermeds = new HashSet<>(); // Case 7: Make a PKIXValidator with valid arguments // Expected result: Well-formed PKIXValidator object System.out.println("Constructor test 7: Valid inputs"); // Set up the PKIXBuilderParameters X509CertSelector sel = new X509CertSelector(); sel.setSubject("CN=User"); PKIXBuilderParameters pbParams = new PKIXBuilderParameters(taSet, sel); pbParams.setRevocationEnabled(false); pbParams.setDate(new Date(1426399200000L)); // 03-15-2014 6:00:00 GMT valOK = Validator.getInstance(Validator.TYPE_PKIX, Validator.VAR_GENERIC, pbParams); // Convert our user cert from PEM format, then do the same for // its intermediate signer and add that as a helper for path building chain[0] = makeCertFromPEM(USER); intermeds.add(makeCertFromPEM(INTERMED)); showValidatedChain(valOK, chain, intermeds); // Case 8: Make a PKIXValidator but provide a null PKIXBuilderParameters // Expected result: throw NullPointerException System.out.println("Constructor test 8: null params"); try { valNoGood = Validator.getInstance(Validator.TYPE_PKIX, Validator.VAR_GENERIC, (PKIXBuilderParameters)null); // Throw something non Runtime-related to indicate we shouldn't // have succeeded on construction. throw new IOException( "Constructor did not throw NullPointerException"); } catch (NullPointerException npe) { System.out.println("\tCaught RuntimeException (" + npe.toString() + ") [PASS])"); } }