Documentation ¶
Overview ¶
Package crypto handles all the cryptographical functions for SKDS. auth.go handles authentication functions. crypto.go handles general purpose encryption/decryption. encoding.go handles encoding and decoding of generic binary data. x509.go handles x509 certificates and ECDSA keys.
Package crypto handles all the cryptographical functions for SKDS. auth.go handles authentication functions. crypto.go handles general purpose encryption/decryption. encoding.go handles encoding and decoding of generic binary data. x509.go handles x509 certificates and ECDSA keys.
Package crypto handles all the cryptographical functions for SKDS. auth.go handles authentication functions. crypto.go handles general purpose encryption/decryption. encoding.go handles encoding and decoding of generic binary data. x509.go handles x509 certificates and ECDSA keys.
Package crypto handles all the cryptographical functions for SKDS. auth.go handles authentication functions. crypto.go handles general purpose encryption/decryption. encoding.go handles encoding and decoding of generic binary data. x509.go handles x509 certificates and ECDSA keys.
Index ¶
- Constants
- func Decrypt(payload []byte, key *Key) (out []byte, err error)
- func Encrypt(payload []byte, key *Key, pubkey *Key) (out []byte, err error)
- func NewMAC(key []byte, url string, msg []byte) string
- func PasswordVerify(pass, hash Binary) (ok bool, err error)
- func RandomInt() (int64, error)
- func TLSCertKeyPair(cert *TLSCert, key *TLSKey) (tlsCert []tls.Certificate)
- func VerifyMAC(key []byte, msgMac string, url string, msg []byte) (ok bool)
- func Zero(in Binary)
- type Binary
- type CertPool
- type Key
- type TLSCert
- type TLSKey
- type TLSPubKey
Constants ¶
const (
// MinPasswordLen is the minimum acceptable password length.
MinPasswordLen = 8
)
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt is a general asymmetric decryption Uses the public key enclosed in the payload for decryption.
func Encrypt ¶
Encrypt is a general asymmetric encryption function. The public part of 'key' is enclosed in the output as a signing key, and is needed in order to decrypt the payload.
func PasswordVerify ¶
PasswordVerify verifies a password against a hash.
func TLSCertKeyPair ¶
func TLSCertKeyPair(cert *TLSCert, key *TLSKey) (tlsCert []tls.Certificate)
TLSCertKeyPair creates a TLS cert object from a cert and key.
Types ¶
type Binary ¶
type Binary []byte
Binary is a byte slice type. Used for any []byte data that needs to be sent across the wire, or read/written to disk.
func NewPassword ¶
NewPassword randomly generates a new password from [0-9][a-z][A-Z].
func PasswordHash ¶
PasswordHash creates a salted scrypt hash from a password.
func (*Binary) DecodeString ¶
DecodeString decodes binary data from a base64 string.
func (*Binary) EncodeString ¶
EncodeString encodes binary data directly into a string. Useful if sending the data in headers.
type CertPool ¶
CertPool is a Certificate pool. We have to maintain our own certs slice as well as the pool object, as there's no method to get the original certs out of a pool.
type Key ¶
Key is a keypair structure.
type TLSCert ¶
type TLSCert struct {
// contains filtered or unexported fields
}
TLSCert is a x509 certificate.