protected static SslContextBuilder newServerSslContextBuilder(final Security security) {
        try {
            final Resource privateKey = security.getPrivateKey();
            final Resource keyStore = security.getKeyStore();

            if (privateKey != null) {
                final Resource certificateChain =
                        requireNonNull(security.getCertificateChain(), "certificateChain");
                final String privateKeyPassword = security.getPrivateKeyPassword();
                try (InputStream certificateChainStream = certificateChain.getInputStream();
                        InputStream privateKeyStream = privateKey.getInputStream()) {
                    return GrpcSslContexts.forServer(certificateChainStream, privateKeyStream, privateKeyPassword);
                }

            } else if (keyStore != null) {
                final KeyManagerFactory keyManagerFactory = KeyStoreUtils.loadKeyManagerFactory(
                        security.getKeyStoreFormat(), keyStore, security.getKeyStorePassword());
                return GrpcSslContexts.configure(SslContextBuilder.forServer(keyManagerFactory));

            } else {
                throw new IllegalStateException("Neither privateKey nor keyStore configured");
            }
        } catch (final Exception e) {
            throw new IllegalArgumentException("Failed to create SSLContext (PK/Cert)", e);
        }
    }
Creates a new server ssl context builder.

@param security The security configuration to use.
@return The newly created SslContextBuilder.
grpc-server-spring-boot-starter/src/main/java/net/devh/boot/grpc/server/serverfactory/ShadedNettyGrpcServerFactory.java