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 ¶
- func AppendKeyPair(tlsConfig *tls.Config, certFile string, keyFile string) error
- func AppendKeyPairWithPassword(tlsConfig *tls.Config, certFile string, keyFile string, pemPass []byte) error
- func GetPEMPassword(pemFile string) []byte
- func IsEncryptedPEM(pemFile string) bool
- func ListenAndServeTLS(addr string, handler nethttp.Handler, tlsConfig *tls.Config) error
- func NewTLSConfig(caFile string, verifyCert bool) (*tls.Config, error)
- func ReadCAFile(caFile string) (*x509.CertPool, error)
- func ReadPEMData(pemFile string, pemPass []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendKeyPair ¶
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 ¶
GetPEMPassword print a password prompt on the terminal and collect a password
func IsEncryptedPEM ¶
IsEncryptedPEM determine if PEM file is encrypted
func ListenAndServeTLS ¶
ListenAndServeTLS acts identically to http.ListenAndServeTLS, except that it expects TLS configuration. TODO: refactor so this is testable?
func NewTLSConfig ¶
NewTLSConfig returns an initialized TLS configuration suitable for client authentication. If caFile is non-empty, it will be loaded.
func ReadCAFile ¶
Returns CA certificate. If caFile is non-empty, it will be loaded.
Types ¶
This section is empty.