use of sun.security.x509.URIName in project jdk8u_jdk by JetBrains.
the class Parse method main.
public static void main(String[] args) throws Exception {
/* Try to parse a CRLDistributionPointsExtension URI with a space. */
try {
CRLDistributionPointsExtensionTest(certWithSpaceInCDPStr);
throw new RuntimeException("Illegally parsed a " + "CRLDistributionPointsExtension uri with a space.");
} catch (IOException e) {
System.out.println("Caught the correct exception.");
}
/* Try to parse a CRLDistributionPointsExtension URI with backslashes. */
try {
CRLDistributionPointsExtensionTest(certWithBackslashesInCDPStr);
throw new RuntimeException("Illegally parsed a " + "CRLDistributionPointsExtension uri with a backslashes.");
} catch (IOException e) {
System.out.println("Caught the correct exception.");
}
/* Try to construct a URIName from a uri with a space. */
String uriWithSpace = "file://crl file.crl";
URIName name;
try {
name = new URIName(uriWithSpace);
throw new RuntimeException("Illegally created a URIName " + "from a uri with a space.");
} catch (IOException e) {
System.out.println("Caught the correct exception.");
}
/* Try to construct a URIName from a uri with backslashes. */
String uriWithBackslashes = "file://\\\\CRL\\crl_file.crl";
try {
name = new URIName(uriWithBackslashes);
throw new RuntimeException("Illegally created a URIName " + "from a uri with backslashes.");
} catch (IOException e) {
System.out.println("Caught the correct exception.");
}
System.out.println("Tests passed.");
}
use of sun.security.x509.URIName in project Bytecoder by mirkosertic.
the class OCSP method getResponderURI.
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;
}
Aggregations