Home / Class/ GeneralNameUtils Class — netty Architecture

GeneralNameUtils Class — netty Architecture

Architecture documentation for the GeneralNameUtils class in GeneralNameUtils.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a98ec35c_c4a1_cd1b_32db_ba8571c54e7b["GeneralNameUtils"]
  9eaaaaa3_09ad_880a_48c4_5289dccf3038["GeneralNameUtils.java"]
  a98ec35c_c4a1_cd1b_32db_ba8571c54e7b -->|defined in| 9eaaaaa3_09ad_880a_48c4_5289dccf3038
  d04f3c6f_4a87_717a_1127_bb774799754f["GeneralNameUtils()"]
  a98ec35c_c4a1_cd1b_32db_ba8571c54e7b -->|method| d04f3c6f_4a87_717a_1127_bb774799754f
  f20f086b_5521_7a1d_3736_ddc2ba613317["GeneralName()"]
  a98ec35c_c4a1_cd1b_32db_ba8571c54e7b -->|method| f20f086b_5521_7a1d_3736_ddc2ba613317

Relationship Graph

Source Code

pkitesting/src/main/java/io/netty/pkitesting/GeneralNameUtils.java lines 36–92

final class GeneralNameUtils {
    private GeneralNameUtils() {
    }

    static GeneralName otherName(String oid, byte[] value) {
        try {
            DERSequence wrappedValue = new DERSequence(new ASN1Encodable[]{
                    new ASN1ObjectIdentifier(oid),
                    new DERTaggedObject(true, 0, ASN1Primitive.fromByteArray(value))
            });
            return new GeneralName(GeneralName.otherName, wrappedValue);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    static GeneralName rfc822Name(String emailAddress) {
        return new GeneralName(GeneralName.rfc822Name, emailAddress);
    }

    static GeneralName dnsName(String dnsName) {
        URI uri = URI.create("ip://" + dnsName);
        String host = uri.getHost();
        return new GeneralName(GeneralName.dNSName, host);
    }

    static GeneralName directoryName(String x500Name) {
        return directoryName(new X500Principal(x500Name));
    }

    static GeneralName directoryName(X500Principal name) {
        try {
            return new GeneralName(GeneralName.directoryName, ASN1Primitive.fromByteArray(name.getEncoded()));
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    static GeneralName uriName(String uri) throws URISyntaxException {
        return uriName(new URI(uri));
    }

    static GeneralName uriName(URI uri) {
        return new GeneralName(GeneralName.uniformResourceIdentifier, uri.toASCIIString());
    }

    static GeneralName ipAddress(String ipAddress) {
        if (!NetUtil.isValidIpV4Address(ipAddress) && !NetUtil.isValidIpV6Address(ipAddress)) {
            throw new IllegalArgumentException("Not a valid IP address: " + ipAddress);
        }
        return new GeneralName(GeneralName.iPAddress, ipAddress);
    }

    static GeneralName registeredId(String oid) {
        return new GeneralName(GeneralName.registeredID, oid);
    }
}

Frequently Asked Questions

What is the GeneralNameUtils class?
GeneralNameUtils is a class in the netty codebase, defined in pkitesting/src/main/java/io/netty/pkitesting/GeneralNameUtils.java.
Where is GeneralNameUtils defined?
GeneralNameUtils is defined in pkitesting/src/main/java/io/netty/pkitesting/GeneralNameUtils.java at line 36.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free