public static URIName nameConstraint(DerValue value) throws IOException {
  URI uri;
  String name=value.getIA5String();
  try {
    uri=new URI(name);
  }
 catch (  URISyntaxException use) {
    throw new IOException("invalid URI name constraint:" + name,use);
  }
  if (uri.getScheme() == null) {
    String host=uri.getSchemeSpecificPart();
    try {
      DNSName hostDNS;
      if (host.startsWith(".")) {
        hostDNS=new DNSName(host.substring(1));
      }
 else {
        hostDNS=new DNSName(host);
      }
      return new URIName(uri,host,hostDNS);
    }
 catch (    IOException ioe) {
      throw new IOException("invalid URI name constraint:" + name,ioe);
    }
  }
 else {
    throw new IOException("invalid URI name constraint (should not " + "include scheme):" + name);
  }
}

public static URIName nameConstraint ( DerValue value ) throws IOException { URI uri ; String name = value . getIA5String ( ) ; try { uri = new URI ( name ) ; } catch ( URISyntaxException use ) { throw new IOException ( "invalid URI name constraint:" + name , use ) ; } if ( uri . getScheme ( ) == null ) { String host = uri . getSchemeSpecificPart ( ) ; try { DNSName hostDNS ; if ( host . startsWith ( "." ) ) { hostDNS = new DNSName ( host . substring ( 1 ) ) ; } else { hostDNS = new DNSName ( host ) ; } return new URIName ( uri , host , hostDNS ) ; } catch ( IOException ioe ) { throw new IOException ( "invalid URI name constraint:" + name , ioe ) ; } } else { throw new IOException ( "invalid URI name constraint (should not " + "include scheme):" + name ) ; } }
create the uriname object with the specified name constraint . uri name constraints syntax is different than subjectaltnames , etc . see 4 . 2 . 1 . 11 of rfc 3280 .
