Documentation ¶
Index ¶
- Constants
- Variables
- func AddLogFlags(flagset *flag.FlagSet)
- func Base64UrlDecode(s string) ([]byte, error)
- func Base64UrlEncode(data []byte) string
- func CertificateToPem(cert *x509.Certificate) *pem.Block
- func CreateEcdsaPrivateKey(curve elliptic.Curve) (*ecdsa.PrivateKey, error)
- func CreatePrivateKey(keyType KeyType, curve Curve, rsaBits *int) (interface{}, error)
- func CreateRsaPrivateKey(bits int) (*rsa.PrivateKey, error)
- func DebugLogHttpRequest(req *HttpRequest, hReq *http.Request)
- func DebugLogHttpResponse(resp *HttpResponse)
- func Debugf(format string, v ...interface{})
- func DecodePrivateKey(block pem.Block) (interface{}, error)
- func DecodePublicKey(block pem.Block) (interface{}, error)
- func DecryptPemBlock(block *pem.Block, prompt func() (string, error)) (err error)
- func EncodePrivateKey(privateKey interface{}) (*pem.Block, error)
- func EncodePublicKey(publicKey interface{}) (*pem.Block, error)
- func EncryptPemBlock(block *pem.Block, password string, alg x509.PEMCipher) error
- func EncryptPrivateKey(privateKey interface{}, password string, alg x509.PEMCipher) (*pem.Block, error)
- func Errorf(format string, v ...interface{})
- func Fatalf(format string, v ...interface{})
- func FirstPemBlock(r io.Reader, types ...string) (*pem.Block, error)
- func FormatDuration(duration time.Duration) string
- func Infof(format string, v ...interface{})
- func IsValidHex(s string) bool
- func LoadFirstPrivateKey(r io.Reader, prompt func() (string, error)) (interface{}, error)
- func LoadFirstPublicKey(r io.Reader, prompt func() (string, error)) (interface{}, error)
- func LoadPemBlocks(r io.Reader, prompt func() (string, error)) ([]*pem.Block, error)
- func MakeCertificate(parameters CertificateParameters) (*pem.Block, error)
- func MakeCertificateRequest(parameters CertificateRequestParameters) (*pem.Block, error)
- func MakeSerialNumber() (*big.Int, error)
- func MustBase64UrlDecode(s string) []byte
- func MustEncodeJson(v interface{}) []byte
- func MustHexDecode(s string) []byte
- func MustPrettyEncodeJson(v interface{}) []byte
- func MustPublicKey(privateKey interface{}) interface{}
- func PickSignatureAlgorithm(privateKey interface{}, defaultAlg x509.SignatureAlgorithm) x509.SignatureAlgorithm
- func PublicKey(privateKey interface{}) (pubKey interface{}, err error)
- func Warningf(format string, v ...interface{})
- type CertificateParameters
- type CertificateRequestParameters
- type Curve
- type HttpLink
- type HttpRequest
- type HttpRequestHeader
- type HttpResponse
- type KeyType
- type LogLevel
Constants ¶
View Source
const PemDefaultCipher = x509.PEMCipherAES256
Variables ¶
View Source
var CurrentLogLevel = WARNING
View Source
var InvalidRsaBits = errors.New("Invalid RSA bits (must be in range 2048..4096)")
View Source
var UnknownCurve = errors.New("Unknown Curve")
View Source
var UnknownKeyType = errors.New("Unknown Key Type")
View Source
var UnknownPrivateKey = errors.New("Unknown Private Key")
Functions ¶
func AddLogFlags ¶
func CertificateToPem ¶
func CertificateToPem(cert *x509.Certificate) *pem.Block
func CreateEcdsaPrivateKey ¶
func CreateEcdsaPrivateKey(curve elliptic.Curve) (*ecdsa.PrivateKey, error)
func CreatePrivateKey ¶
func CreateRsaPrivateKey ¶
func CreateRsaPrivateKey(bits int) (*rsa.PrivateKey, error)
func DebugLogHttpRequest ¶
func DebugLogHttpRequest(req *HttpRequest, hReq *http.Request)
func DebugLogHttpResponse ¶
func DebugLogHttpResponse(resp *HttpResponse)
fetch response data (if you're intrested in it) before calling this, and pass it along
func DecodePrivateKey ¶
func DecodePublicKey ¶
func DecryptPemBlock ¶
func EncodePrivateKey ¶
func EncodePublicKey ¶
func EncryptPemBlock ¶
func EncryptPrivateKey ¶
func FormatDuration ¶
func IsValidHex ¶
func LoadFirstPrivateKey ¶
func LoadFirstPublicKey ¶
func LoadPemBlocks ¶
func MakeCertificate ¶
func MakeCertificate(parameters CertificateParameters) (*pem.Block, error)
func MakeCertificateRequest ¶
func MakeCertificateRequest(parameters CertificateRequestParameters) (*pem.Block, error)
func MakeSerialNumber ¶
func MustEncodeJson ¶
func MustEncodeJson(v interface{}) []byte
func MustHexDecode ¶
func MustPrettyEncodeJson ¶
func MustPrettyEncodeJson(v interface{}) []byte
func MustPublicKey ¶
func MustPublicKey(privateKey interface{}) interface{}
func PickSignatureAlgorithm ¶
func PickSignatureAlgorithm(privateKey interface{}, defaultAlg x509.SignatureAlgorithm) x509.SignatureAlgorithm
Types ¶
type CertificateParameters ¶
type CertificateRequestParameters ¶
type CertificateRequestParameters struct { PrivateKey interface{} DefaultSignatureAlgorithm x509.SignatureAlgorithm Subject pkix.Name DNSNames []string }
type HttpRequest ¶
type HttpRequest struct { Method string URL string Body []byte Headers HttpRequestHeader }
func (*HttpRequest) Run ¶
func (req *HttpRequest) Run() (*HttpResponse, error)
type HttpRequestHeader ¶
type HttpResponse ¶
Click to show internal directories.
Click to hide internal directories.