Documentation ¶
Index ¶
- Constants
- Variables
- func CCCSPBackedSigner(caFile, keyFile string, policy *config.Signing, csp cccsp.CCCSP) (signer.Signer, error)
- func CCCSPKeyRequestGenerate(req *csr.CertificateRequest, csp cccsp.CCCSP) (cccsp.Key, crypto.Signer, error)
- func CreateToken(csp cccsp.CCCSP, cert []byte, key cccsp.Key, method, uri string, body []byte) (string, error)
- func Fatal(format string, v ...interface{})
- func FileExists(name string) bool
- func GenECDSAToken(csp cccsp.CCCSP, cert []byte, key cccsp.Key, method, uri string, body []byte) (string, error)
- func GetECPrivateKey(raw []byte) (*ecdsa.PrivateKey, error)
- func GetEnrollmentIDFromPEM(cert []byte) (string, error)
- func GetEnrollmentIDFromX509Certificate(cert *x509.Certificate) string
- func GetMaskedURL(url string) string
- func GetRSAPrivateKey(raw []byte) (*rsa.PrivateKey, error)
- func GetSerialAsHex(serial *big.Int) string
- func GetSignerFromCert(cert *x509.Certificate, csp cccsp.CCCSP) (cccsp.Key, crypto.Signer, error)
- func GetSignerFromCertFile(certFile string, csp cccsp.CCCSP) (cccsp.Key, crypto.Signer, *x509.Certificate, error)
- func GetX509CertificateFromPEM(cert []byte) (*x509.Certificate, error)
- func ImportCCCSPKeyFromPEM(keyFile string, csp cccsp.CCCSP, temporary bool) (cccsp.Key, error)
- func InitCCCSP(path string) (cccsp.CCCSP, error)
- func LoadX509KeyPair(certFile, keyFile string, csp cccsp.CCCSP) (*tls.Certificate, error)
- func MakeFileAbs(file, dir string) (string, error)
- func MakeFileNamesAbsolute(files []*string, home string) error
- func Marshal(from interface{}, what string) ([]byte, error)
- func NormalizeStringSlice(slice []string) []string
- func ParseObject(obj interface{}, cb func(*Field) error, tags map[string]string) error
- func RandomString(n int) string
- func Read(r io.Reader, data []byte) ([]byte, error)
- func RegisterFlags(v *viper.Viper, flags *pflag.FlagSet, config interface{}, ...) error
- func Unmarshal(from []byte, to interface{}, what string) error
- func WriteFile(file string, buf []byte, perm os.FileMode) error
- type Field
Constants ¶
const ( // TagDefault is the tag name for a default value of a field as recognized // by RegisterFlags. TagDefault = "def" // TagHelp is the tag name for a help message of a field as recognized // by RegisterFlags. TagHelp = "help" // TagOpt is the tag name for a one character option of a field as recognized // by RegisterFlags. For example, a value of "d" reserves "-d" for the // command line argument. TagOpt = "opt" // TagSkip is the tag name which causes the field to be skipped by // RegisterFlags. TagSkip = "skip" // TagHide is the tag name which causes the field to be hidden TagHide = "hide" )
Variables ¶
var URLRegex = regexp.MustCompile("(http)s*://(\\S+):(\\S+)@")
URLRegex is the regular expression to check if a value is an URL
Functions ¶
func CCCSPBackedSigner ¶
func CCCSPBackedSigner(caFile, keyFile string, policy *config.Signing, csp cccsp.CCCSP) (signer.Signer, error)
CCCSPBackedSigner attempts to create a signer using csp cccsp.CCCSP.
func CCCSPKeyRequestGenerate ¶
func CCCSPKeyRequestGenerate(req *csr.CertificateRequest, csp cccsp.CCCSP) (cccsp.Key, crypto.Signer, error)
CCCSPKeyRequestGenerate generates keys through CCCSP somewhat mirroring to cfssl/req.KeyRequest.Generate()
func CreateToken ¶
func CreateToken(csp cccsp.CCCSP, cert []byte, key cccsp.Key, method, uri string, body []byte) (string, error)
CreateToken creates a JWT-like token.
func GenECDSAToken ¶
func GenECDSAToken(csp cccsp.CCCSP, cert []byte, key cccsp.Key, method, uri string, body []byte) (string, error)
GenECDSAToken signs the http body and cert with ECDSA using EC private key
func GetECPrivateKey ¶
func GetECPrivateKey(raw []byte) (*ecdsa.PrivateKey, error)
GetECPrivateKey get *ecdsa.PrivateKey from key pem
func GetEnrollmentIDFromPEM ¶
GetEnrollmentIDFromPEM returns the EnrollmentID from a PEM buffer
func GetEnrollmentIDFromX509Certificate ¶
func GetEnrollmentIDFromX509Certificate(cert *x509.Certificate) string
GetEnrollmentIDFromX509Certificate returns the EnrollmentID from the x509 certificate
func GetMaskedURL ¶
GetMaskedURL returns masked URL. It masks username and password from the URL if present
func GetRSAPrivateKey ¶
func GetRSAPrivateKey(raw []byte) (*rsa.PrivateKey, error)
GetRSAPrivateKey get *rsa.PrivateKey from key pem
func GetSerialAsHex ¶
GetSerialAsHex returns the serial number from certificate as hex format
func GetSignerFromCert ¶
GetSignerFromCert load private key represented by ski and return cccsp signer that conforms to crypto.Signer
func GetSignerFromCertFile ¶
func GetSignerFromCertFile(certFile string, csp cccsp.CCCSP) (cccsp.Key, crypto.Signer, *x509.Certificate, error)
GetSignerFromCertFile load skifile and load private key represented by ski and return cccsp signer that conforms to crypto.Signer
func GetX509CertificateFromPEM ¶
func GetX509CertificateFromPEM(cert []byte) (*x509.Certificate, error)
GetX509CertificateFromPEM get on x509 certificate from bytes in PEM format
func ImportCCCSPKeyFromPEM ¶
ImportCCCSPKeyFromPEM attempts to create a private CCCSP key from a pem file keyFile
func LoadX509KeyPair ¶
LoadX509KeyPair reads and parses a public/private key pair from a pair of files.
func MakeFileAbs ¶
MakeFileAbs makes 'file' absolute relative to 'dir' if not already absolute
func MakeFileNamesAbsolute ¶
MakeFileNamesAbsolute makes all file names in the list absolute, relative to home
func NormalizeStringSlice ¶
NormalizeStringSlice checks for seperators
func ParseObject ¶
ParseObject parses an object structure, calling back with field info for each field
func RegisterFlags ¶
func RegisterFlags(v *viper.Viper, flags *pflag.FlagSet, config interface{}, tags map[string]string) error
RegisterFlags registers flags for all fields in an arbitrary 'config' object. This method recognizes the following field tags: "def" - the default value of the field; "opt" - the optional one character short name to use on the command line; "help" - the help message to display on the command line; "skip" - to skip the field.