sun.security.x509.GeneralName Java Examples
The following examples show how to use
sun.security.x509.GeneralName.
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: OCSP.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals( AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #2
Source File: OCSP.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals((Object) AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #3
Source File: OCSP.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals((Object) AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #4
Source File: OCSP.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals( AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #5
Source File: OCSP.java From hottub with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals((Object) AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #6
Source File: OCSP.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals((Object) AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #7
Source File: OCSP.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals( AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #8
Source File: OCSP.java From Bytecoder with Apache License 2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals( AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #9
Source File: OCSP.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals((Object) AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #10
Source File: OCSP.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals( AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #11
Source File: OCSP.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals( AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #12
Source File: OCSP.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals((Object) AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #13
Source File: OCSP.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals( AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #14
Source File: OCSP.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals((Object) AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #15
Source File: OCSP.java From j2objc with Apache License 2.0 | 6 votes |
static URI getResponderURI(X509CertImpl certImpl) { // Examine the certificate's AuthorityInfoAccess extension AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); if (aia == null) { return null; } List<AccessDescription> descriptions = aia.getAccessDescriptions(); for (AccessDescription description : descriptions) { if (description.getAccessMethod().equals((Object) AccessDescription.Ad_OCSP_Id)) { GeneralName generalName = description.getAccessLocation(); if (generalName.getType() == GeneralNameInterface.NAME_URI) { URIName uri = (URIName) generalName.getName(); return uri.getURI(); } } } return null; }
Example #16
Source File: X509CertSelectorTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void testSubjectAltName() throws IOException { System.out.println("X.509 Certificate Match on subjectAltName"); // bad match X509CertSelector selector = new X509CertSelector(); GeneralNameInterface dnsName = new DNSName("foo.com"); DerOutputStream tmp = new DerOutputStream(); dnsName.encode(tmp); selector.addSubjectAlternativeName(2, tmp.toByteArray()); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17")); byte[] encoded = in.getOctetString(); SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded); GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); GeneralName name = (GeneralName) names.get(0); selector.setSubjectAlternativeNames(null); DerOutputStream tmp2 = new DerOutputStream(); name.getName().encode(tmp2); selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray()); checkMatch(selector, cert, true); // good match 2 (matches at least one) selector.setMatchAllSubjectAltNames(false); selector.addSubjectAlternativeName(2, "foo.com"); checkMatch(selector, cert, true); }
Example #17
Source File: X509CertSelectorTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static GeneralSubtree getGeneralSubtree(GeneralNameInterface gni) { // Create a new GeneralSubtree with the specified name, 0 base, and // unlimited length GeneralName gn = new GeneralName(gni); GeneralSubtree subTree = new GeneralSubtree(gn, 0, -1); return subTree; }
Example #18
Source File: X509CertSelectorTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void testSubjectAltName() throws IOException { System.out.println("X.509 Certificate Match on subjectAltName"); // bad match X509CertSelector selector = new X509CertSelector(); GeneralNameInterface dnsName = new DNSName("foo.com"); DerOutputStream tmp = new DerOutputStream(); dnsName.encode(tmp); selector.addSubjectAlternativeName(2, tmp.toByteArray()); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17")); byte[] encoded = in.getOctetString(); SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded); GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); GeneralName name = (GeneralName) names.get(0); selector.setSubjectAlternativeNames(null); DerOutputStream tmp2 = new DerOutputStream(); name.getName().encode(tmp2); selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray()); checkMatch(selector, cert, true); // good match 2 (matches at least one) selector.setMatchAllSubjectAltNames(false); selector.addSubjectAlternativeName(2, "foo.com"); checkMatch(selector, cert, true); }
Example #19
Source File: X509CertSelectorTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static GeneralSubtree getGeneralSubtree(GeneralNameInterface gni) { // Create a new GeneralSubtree with the specified name, 0 base, and // unlimited length GeneralName gn = new GeneralName(gni); GeneralSubtree subTree = new GeneralSubtree(gn, 0, -1); return subTree; }
Example #20
Source File: X509CertSelectorTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void testSubjectAltName() throws IOException { System.out.println("X.509 Certificate Match on subjectAltName"); // bad match X509CertSelector selector = new X509CertSelector(); GeneralNameInterface dnsName = new DNSName("foo.com"); DerOutputStream tmp = new DerOutputStream(); dnsName.encode(tmp); selector.addSubjectAlternativeName(2, tmp.toByteArray()); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17")); byte[] encoded = in.getOctetString(); SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded); GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); GeneralName name = (GeneralName) names.get(0); selector.setSubjectAlternativeNames(null); DerOutputStream tmp2 = new DerOutputStream(); name.getName().encode(tmp2); selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray()); checkMatch(selector, cert, true); // good match 2 (matches at least one) selector.setMatchAllSubjectAltNames(false); selector.addSubjectAlternativeName(2, "foo.com"); checkMatch(selector, cert, true); }
Example #21
Source File: CertificateBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Helper method to add one or more OCSP URIs to the Authority Info Access * certificate extension. * * @param locations A list of one or more OCSP responder URIs as strings * * @throws IOException if an encoding error occurs. */ public void addAIAExt(List<String> locations) throws IOException { if (!locations.isEmpty()) { List<AccessDescription> acDescList = new ArrayList<>(); for (String ocspUri : locations) { acDescList.add(new AccessDescription( AccessDescription.Ad_OCSP_Id, new GeneralName(new URIName(ocspUri)))); } addExtension(new AuthorityInfoAccessExtension(acDescList)); } }
Example #22
Source File: CertificateBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Helper method to add DNSName types for the SAN extension * * @param dnsNames A {@code List} of names to add as DNSName types * * @throws IOException if an encoding error occurs. */ public void addSubjectAltNameDNSExt(List<String> dnsNames) throws IOException { if (!dnsNames.isEmpty()) { GeneralNames gNames = new GeneralNames(); for (String name : dnsNames) { gNames.add(new GeneralName(new DNSName(name))); } addExtension(new SubjectAlternativeNameExtension(false, gNames)); } }
Example #23
Source File: X509CertSelectorTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static GeneralSubtree getGeneralSubtree(GeneralNameInterface gni) { // Create a new GeneralSubtree with the specified name, 0 base, and // unlimited length GeneralName gn = new GeneralName(gni); GeneralSubtree subTree = new GeneralSubtree(gn, 0, -1); return subTree; }
Example #24
Source File: X509CertSelectorTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void testSubjectAltName() throws IOException { System.out.println("X.509 Certificate Match on subjectAltName"); // bad match X509CertSelector selector = new X509CertSelector(); GeneralNameInterface dnsName = new DNSName("foo.com"); DerOutputStream tmp = new DerOutputStream(); dnsName.encode(tmp); selector.addSubjectAlternativeName(2, tmp.toByteArray()); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17")); byte[] encoded = in.getOctetString(); SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded); GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); GeneralName name = (GeneralName) names.get(0); selector.setSubjectAlternativeNames(null); DerOutputStream tmp2 = new DerOutputStream(); name.getName().encode(tmp2); selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray()); checkMatch(selector, cert, true); // good match 2 (matches at least one) selector.setMatchAllSubjectAltNames(false); selector.addSubjectAlternativeName(2, "foo.com"); checkMatch(selector, cert, true); }
Example #25
Source File: X509CertSelectorTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private void testSubjectAltName() throws IOException { System.out.println("X.509 Certificate Match on subjectAltName"); // bad match X509CertSelector selector = new X509CertSelector(); GeneralNameInterface dnsName = new DNSName("foo.com"); DerOutputStream tmp = new DerOutputStream(); dnsName.encode(tmp); selector.addSubjectAlternativeName(2, tmp.toByteArray()); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17")); byte[] encoded = in.getOctetString(); SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded); GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); GeneralName name = (GeneralName) names.get(0); selector.setSubjectAlternativeNames(null); DerOutputStream tmp2 = new DerOutputStream(); name.getName().encode(tmp2); selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray()); checkMatch(selector, cert, true); // good match 2 (matches at least one) selector.setMatchAllSubjectAltNames(false); selector.addSubjectAlternativeName(2, "foo.com"); checkMatch(selector, cert, true); }
Example #26
Source File: X509CertSelectorTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void testSubjectAltName() throws IOException { System.out.println("X.509 Certificate Match on subjectAltName"); // bad match X509CertSelector selector = new X509CertSelector(); GeneralNameInterface dnsName = new DNSName("foo.com"); DerOutputStream tmp = new DerOutputStream(); dnsName.encode(tmp); selector.addSubjectAlternativeName(2, tmp.toByteArray()); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17")); byte[] encoded = in.getOctetString(); SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded); GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); GeneralName name = (GeneralName) names.get(0); selector.setSubjectAlternativeNames(null); DerOutputStream tmp2 = new DerOutputStream(); name.getName().encode(tmp2); selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray()); checkMatch(selector, cert, true); // good match 2 (matches at least one) selector.setMatchAllSubjectAltNames(false); selector.addSubjectAlternativeName(2, "foo.com"); checkMatch(selector, cert, true); }
Example #27
Source File: X509CertSelectorTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static GeneralSubtree getGeneralSubtree(GeneralNameInterface gni) { // Create a new GeneralSubtree with the specified name, 0 base, and // unlimited length GeneralName gn = new GeneralName(gni); GeneralSubtree subTree = new GeneralSubtree(gn, 0, -1); return subTree; }
Example #28
Source File: X509CertSelectorTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static GeneralSubtree getGeneralSubtree(GeneralNameInterface gni) { // Create a new GeneralSubtree with the specified name, 0 base, and // unlimited length GeneralName gn = new GeneralName(gni); GeneralSubtree subTree = new GeneralSubtree(gn, 0, -1); return subTree; }
Example #29
Source File: X509CertSelectorTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static GeneralSubtree getGeneralSubtree(GeneralNameInterface gni) { // Create a new GeneralSubtree with the specified name, 0 base, and // unlimited length GeneralName gn = new GeneralName(gni); GeneralSubtree subTree = new GeneralSubtree(gn, 0, -1); return subTree; }
Example #30
Source File: X509CertSelectorTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void testSubjectAltName() throws IOException { System.out.println("X.509 Certificate Match on subjectAltName"); // bad match X509CertSelector selector = new X509CertSelector(); GeneralNameInterface dnsName = new DNSName("foo.com"); DerOutputStream tmp = new DerOutputStream(); dnsName.encode(tmp); selector.addSubjectAlternativeName(2, tmp.toByteArray()); checkMatch(selector, cert, false); // good match DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17")); byte[] encoded = in.getOctetString(); SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded); GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME); GeneralName name = (GeneralName) names.get(0); selector.setSubjectAlternativeNames(null); DerOutputStream tmp2 = new DerOutputStream(); name.getName().encode(tmp2); selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray()); checkMatch(selector, cert, true); // good match 2 (matches at least one) selector.setMatchAllSubjectAltNames(false); selector.addSubjectAlternativeName(2, "foo.com"); checkMatch(selector, cert, true); }