Documentation ¶
Index ¶
- func VersionInfo() string
- type PrivateKey
- func (privateKey *PrivateKey) Bytes() ([]byte, error)
- func (privateKey *PrivateKey) Decrypt(ciphertext []byte) (data []byte, err error)
- func (privateKey *PrivateKey) DecryptStream(dst io.Writer, src io.Reader) (err error)
- func (privateKey *PrivateKey) Encrypt(data []byte, compression bool) (ciphertext []byte, err error)
- func (privateKey *PrivateKey) EncryptStream(dst io.Writer, src io.Reader, compression bool) (err error)
- func (privateKey *PrivateKey) NewDecryptingReader(src io.Reader) (io.ReadCloser, error)
- func (privateKey *PrivateKey) NewEncryptingWriter(dst io.Writer, compression bool) (writer io.WriteCloser, err error)
- func (privateKey *PrivateKey) PublicKey(pq bool) (*PublicKey, error)
- type PublicKey
- func (publicKey *PublicKey) Bytes() ([]byte, error)
- func (publicKey *PublicKey) Encrypt(data []byte, compression bool) (ciphertext []byte, err error)
- func (publicKey *PublicKey) EncryptStream(dst io.Writer, src io.Reader, compression bool) (err error)
- func (publicKey *PublicKey) NewEncryptingWriter(dst io.Writer, compression bool) (writer io.WriteCloser, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VersionInfo ¶ added in v1.1.0
func VersionInfo() string
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func NewPrivateKey ¶
func NewPrivateKey() (*PrivateKey, error)
NewPrivateKey creates a new random private key.
func NewPrivateKeyForPassword ¶
func NewPrivateKeyForPassword(password []byte) (*PrivateKey, error)
NewPrivateKeyForPassword creates a new private key for the given password.
func NewPrivateKeyForPasswordAndSpec ¶
func NewPrivateKeyForPasswordAndSpec(password []byte, iterations, memory, threads uint8) (*PrivateKey, error)
NewPrivateKeyForPasswordAndSpec creates a new private key for the given password and kdf spec.
func ParsePrivateKey ¶
func ParsePrivateKey(key []byte) (*PrivateKey, error)
ParsePrivateKey parses the given bytes and returns a corresponding private key. the given bytes must be 33 bytes long.
func (*PrivateKey) Bytes ¶
func (privateKey *PrivateKey) Bytes() ([]byte, error)
Bytes returns the private key as bytes only if it is not password based.
func (*PrivateKey) Decrypt ¶
func (privateKey *PrivateKey) Decrypt(ciphertext []byte) (data []byte, err error)
Decrypt decrypts the given ciphertext and returns the decrypted data.
func (*PrivateKey) DecryptStream ¶
DecryptStream decrypts src and writes to dst.
func (*PrivateKey) Encrypt ¶
func (privateKey *PrivateKey) Encrypt(data []byte, compression bool) (ciphertext []byte, err error)
Encrypt encrypts data with the private key treating it as a symmetric key.
func (*PrivateKey) EncryptStream ¶
func (privateKey *PrivateKey) EncryptStream(dst io.Writer, src io.Reader, compression bool) (err error)
EncryptStream encrypts src with the private key treating it as a symmetric key and writes to dst.
func (*PrivateKey) NewDecryptingReader ¶
func (privateKey *PrivateKey) NewDecryptingReader(src io.Reader) (io.ReadCloser, error)
func (*PrivateKey) NewEncryptingWriter ¶
func (privateKey *PrivateKey) NewEncryptingWriter(dst io.Writer, compression bool) (writer io.WriteCloser, err error)
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func ParsePublicKey ¶
ParsePublicKey parses the given bytes and returns a corresponding public key. the given bytes must be at least 33 bytes long.
func (*PublicKey) EncryptStream ¶
func (publicKey *PublicKey) EncryptStream(dst io.Writer, src io.Reader, compression bool) (err error)
EncryptStream encrypts src with the public key and writes to dst.