Home / File/ KeytoolSelfSignedCertGenerator.java — netty Source File

KeytoolSelfSignedCertGenerator.java — netty Source File

Architecture documentation for KeytoolSelfSignedCertGenerator.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2024 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.netty.handler.ssl.util;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.internal.PlatformDependent;

import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.security.cert.X509Certificate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Locale;
import java.util.concurrent.TimeUnit;

/**
 * Self-signed certificate generator based on the keytool CLI.
 */
final class KeytoolSelfSignedCertGenerator {
    private static final DateTimeFormatter DATE_FORMAT =
            DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss", Locale.ROOT);
    private static final String ALIAS = "alias";
    private static final String PASSWORD = "insecurepassword";
    private static final Path KEYTOOL;
    private static final String KEY_STORE_TYPE;

    static {
        String home = System.getProperty("java.home");
        if (home == null) {
            KEYTOOL = null;
        } else {
            Path likely = Paths.get(home).resolve("bin").resolve("keytool");
            if (Files.exists(likely)) {
                KEYTOOL = likely;
            } else {
                KEYTOOL = null;
            }
// ... (83 more lines)

Domain

Subdomains

Frequently Asked Questions

What does KeytoolSelfSignedCertGenerator.java do?
KeytoolSelfSignedCertGenerator.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is KeytoolSelfSignedCertGenerator.java in the architecture?
KeytoolSelfSignedCertGenerator.java is located at handler/src/main/java/io/netty/handler/ssl/util/KeytoolSelfSignedCertGenerator.java (domain: Buffer, subdomain: Allocators, directory: handler/src/main/java/io/netty/handler/ssl/util).

Analyze Your Own Codebase

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

Try Supermodel Free