Home / Function/ PemEncoded() — netty Function Reference

PemEncoded() — netty Function Reference

Architecture documentation for the PemEncoded() function in PemX509Certificate.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  78a8783e_da81_c930_635c_adf8144956d4["PemEncoded()"]
  5a07f07f_f60b_c2b9_81ac_c030312abb06["PemX509Certificate"]
  78a8783e_da81_c930_635c_adf8144956d4 -->|defined in| 5a07f07f_f60b_c2b9_81ac_c030312abb06
  813828f8_5915_680b_1d84_589e2ea1dcb6["release()"]
  78a8783e_da81_c930_635c_adf8144956d4 -->|calls| 813828f8_5915_680b_1d84_589e2ea1dcb6
  style 78a8783e_da81_c930_635c_adf8144956d4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java lines 57–99

    static PemEncoded toPEM(ByteBufAllocator allocator, boolean useDirect,
            X509Certificate... chain) throws CertificateEncodingException {

        checkNonEmpty(chain, "chain");

        // We can take a shortcut if there is only one certificate and
        // it already happens to be a PemEncoded instance. This is the
        // ideal case and reason why all this exists. It allows the user
        // to pass pre-encoded bytes straight into OpenSSL without having
        // to do any of the extra work.
        if (chain.length == 1) {
            X509Certificate first = chain[0];
            if (first instanceof PemEncoded) {
                return ((PemEncoded) first).retain();
            }
        }

        boolean success = false;
        ByteBuf pem = null;
        try {
            for (X509Certificate cert : chain) {

                if (cert == null) {
                    throw new IllegalArgumentException("Null element in chain: " + Arrays.toString(chain));
                }

                if (cert instanceof PemEncoded) {
                    pem = append(allocator, useDirect, (PemEncoded) cert, chain.length, pem);
                } else {
                    pem = append(allocator, useDirect, cert, chain.length, pem);
                }
            }

            PemValue value = new PemValue(pem, false);
            success = true;
            return value;
        } finally {
            // Make sure we never leak the PEM's ByteBuf in the event of an Exception
            if (!success && pem != null) {
                pem.release();
            }
        }
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does PemEncoded() do?
PemEncoded() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java.
Where is PemEncoded() defined?
PemEncoded() is defined in handler/src/main/java/io/netty/handler/ssl/PemX509Certificate.java at line 57.
What does PemEncoded() call?
PemEncoded() calls 1 function(s): release.

Analyze Your Own Codebase

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

Try Supermodel Free