ssl

package
v0.0.0-...-6b32d26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 8 Imported by: 8

Documentation

Overview

Copyright 2021 SANGFOR TECHNOLOGIES

Licensed 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

http://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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendKeyPair

func AppendKeyPair(tlsConfig *tls.Config, certFile string, keyFile string) error

AppendKeyPair loads the given TLS key pair and appends it to tlsConfig.Certificates.

func AppendKeyPairWithPassword

func AppendKeyPairWithPassword(tlsConfig *tls.Config, certFile string, keyFile string, pemPass []byte) error

AppendKeyPairWithPassword read in a keypair where the key is password protected

func GetPEMPassword

func GetPEMPassword(pemFile string) []byte

GetPEMPassword print a password prompt on the terminal and collect a password

func IsEncryptedPEM

func IsEncryptedPEM(pemFile string) bool

IsEncryptedPEM determine if PEM file is encrypted

func ListenAndServeTLS

func ListenAndServeTLS(addr string, handler nethttp.Handler, tlsConfig *tls.Config) error

ListenAndServeTLS acts identically to http.ListenAndServeTLS, except that it expects TLS configuration. TODO: refactor so this is testable?

func NewTLSConfig

func NewTLSConfig(caFile string, verifyCert bool) (*tls.Config, error)

NewTLSConfig returns an initialized TLS configuration suitable for client authentication. If caFile is non-empty, it will be loaded.

func ReadCAFile

func ReadCAFile(caFile string) (*x509.CertPool, error)

Returns CA certificate. If caFile is non-empty, it will be loaded.

func ReadPEMData

func ReadPEMData(pemFile string, pemPass []byte) ([]byte, error)

ReadPEMData read a PEM file and ask for a password to decrypt it if needed

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL