Documentation ¶
Index ¶
- Variables
- func BinaryDecode(b []byte, ptr interface{}) error
- func BinaryEncode(value interface{}) ([]byte, error)
- func CreateCertificate(parentPrivateKey *PrivateKey, parentCertificate *Certificate, ...) (*Certificate, *PrivateKey, error)
- func DecodePEM(r io.Reader, decoder BinaryDecoder, banner string, passphrase []byte) error
- func EncodePEM(w io.Writer, encoder BinaryEncoder, banner string, passphrase []byte) error
- func IsKeysMatched(public *PublicKey, private *PrivateKey) bool
- func NewKeyPair() (*PublicKey, *PrivateKey, error)
- type BinaryDecoder
- type BinaryEncoder
- type Certificate
- type CertificateDetails
- type CertificateDetailsFn
- type ChaCha20
- type ChaCha20Stream
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrKeyMismatched = errors.New("keys are mismatched") ErrNotCA = errors.New("given certificate is not a CA") ErrNotIssuer = errors.New("issuer value is not the same") ErrFailedVerifyCertificate = errors.New("certificate is not verified by ca") )
View Source
var ( // ErrChiperTextTooShort if content length is too short for decoding ErrChiperTextTooShort = errors.New("ciphertext too short") // ErrWrongKey is returns when decrypting content is failing ErrWrongKey = errors.New("wrong key") )
View Source
var ( ErrPemBannerNotFound = errors.New("pem banner not found") ErrPemIncorrectFormat = errors.New("pem incurrent format") )
View Source
var ErrWrongFormat = errors.New("wrong format")
Functions ¶
func BinaryDecode ¶
func BinaryEncode ¶
func CreateCertificate ¶
func CreateCertificate(parentPrivateKey *PrivateKey, parentCertificate *Certificate, opts ...CertificateDetailsFn) (*Certificate, *PrivateKey, error)
func IsKeysMatched ¶
func IsKeysMatched(public *PublicKey, private *PrivateKey) bool
IsKeysMatched checks whether both public and private key are belong to each other
func NewKeyPair ¶
func NewKeyPair() (*PublicKey, *PrivateKey, error)
Types ¶
type BinaryDecoder ¶
type BinaryEncoder ¶
type Certificate ¶
type Certificate struct { Details *CertificateDetails Signature []byte }
func (*Certificate) Decode ¶
func (c *Certificate) Decode(b []byte) error
func (*Certificate) DecodeExtra ¶
func (c *Certificate) DecodeExtra(decoder BinaryDecoder) error
func (*Certificate) Encode ¶
func (c *Certificate) Encode() ([]byte, error)
func (*Certificate) Verify ¶
func (c *Certificate) Verify(ca *Certificate) error
type CertificateDetails ¶
type CertificateDetailsFn ¶
type CertificateDetailsFn func(details *CertificateDetails) error
func CertWithAuthority ¶
func CertWithAuthority() CertificateDetailsFn
func CertWithExtra ¶
func CertWithExtra(extra BinaryEncoder) CertificateDetailsFn
func CertWithNotAfter ¶
func CertWithNotAfter(notAfter time.Time) CertificateDetailsFn
func CertWithNotBefore ¶
func CertWithNotBefore(notBefore time.Time) CertificateDetailsFn
type ChaCha20 ¶
type ChaCha20 struct{}
ChaCha20 enecryption type
type ChaCha20Stream ¶
type ChaCha20Stream struct {
// contains filtered or unexported fields
}
func NewChaCha20Stream ¶
func NewChaCha20Stream(r io.Reader, key []byte) (*ChaCha20Stream, error)
func (*ChaCha20Stream) Close ¶
func (cs *ChaCha20Stream) Close() error
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func (*PrivateKey) Decode ¶
func (p *PrivateKey) Decode(b []byte) error
func (*PrivateKey) Encode ¶
func (p *PrivateKey) Encode() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.