Documentation ¶
Overview ¶
MIT License
Copyright (c) 2020, Kairo de Araujo ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- Variables
- func CAPathIsReady() (string, error)
- func CAStorage(commonName string) bool
- func CheckCertExists(f File) bool
- func CopyFile(src, dest string) error
- func ListCAs() []string
- func ListCertificates(CACommonName string) []string
- func LoadFile(filePath ...string) ([]byte, error)
- func MakeFolder(folderPath ...string) error
- func SaveFile(f File) error
- type CreationType
- type File
- type FileType
Constants ¶
const ( PEMFile = "key.pem" PublicPEMFile = "key.pub" )
File name constants
Variables ¶
var ErrIncompleteCopy = errors.New("file copy was incomplete")
Functions ¶
func CAPathIsReady ¶
func CheckCertExists ¶
CheckCertExists returns if a certificate exists or not
func CopyFile ¶ added in v1.2.0
CopyFile copies the specified src file to the given destination. Both paths are relative to the $CAPATH hierarchy.
func ListCAs ¶ added in v1.0.2
func ListCAs() []string
ListCAs return a list of certificates folders
func ListCertificates ¶
ListCertificates return a list of certificates folders
func MakeFolder ¶
MakeFolder creates folder inside the CAPATH infrastructure.
Types ¶
type CreationType ¶
type CreationType int
CreationType represents if CA or Certificate owns the file
const ( // CreationTypeCA owned by CA CreationTypeCA CreationType = 1 << iota // CreationTypeCertificate owned by Certificate CreationTypeCertificate )
type File ¶
type File struct { CA string CommonName string FileType FileType PrivateKeyData *rsa.PrivateKey PublicKeyData rsa.PublicKey CSRData []byte CertData []byte CRLData []byte CreationType CreationType }
File has the content to save a file