libcrypto

package
v0.0.0-...-de3a50d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2014 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package libcrypto implements okapi interfaces using OpenSSL's libcrypto library.

Index

Constants

This section is empty.

Variables

View Source
var (
	RC4      = CipherSpec{0: C.EVP_rc4()}
	AES_ECB  = CipherSpec{16: C.EVP_aes_128_ecb(), 24: C.EVP_aes_192_ecb(), 32: C.EVP_aes_256_ecb()}
	AES_CBC  = CipherSpec{16: C.EVP_aes_128_cbc(), 24: C.EVP_aes_192_cbc(), 32: C.EVP_aes_256_cbc()}
	AES_CFB  = CipherSpec{16: C.EVP_aes_128_cfb(), 24: C.EVP_aes_192_cfb(), 32: C.EVP_aes_256_cfb()}
	AES_OFB  = CipherSpec{16: C.EVP_aes_128_ofb(), 24: C.EVP_aes_192_ofb(), 32: C.EVP_aes_256_ofb()}
	AES_CTR  = CipherSpec{16: C.EVP_aes_128_ctr(), 24: C.EVP_aes_192_ctr(), 32: C.EVP_aes_256_ctr()}
	AES_GCM  = CipherSpec{16: C.EVP_aes_128_gcm(), 24: C.EVP_aes_192_gcm(), 32: C.EVP_aes_256_gcm()}
	AES_CCM  = CipherSpec{16: C.EVP_aes_128_ccm(), 24: C.EVP_aes_192_ccm(), 32: C.EVP_aes_256_ccm()}
	AES_XTS  = CipherSpec{16: C.EVP_aes_128_xts(), 32: C.EVP_aes_256_xts()}
	BF_ECB   = CipherSpec{0: C.EVP_bf_ecb()}
	BF_CBC   = CipherSpec{0: C.EVP_bf_cbc()}
	BF_CFB   = CipherSpec{0: C.EVP_bf_cfb()}
	BF_OFB   = CipherSpec{0: C.EVP_bf_ofb()}
	DES3_ECB = CipherSpec{0: C.EVP_des_ede3_ecb()}
	DES3_CBC = CipherSpec{0: C.EVP_des_ede3_cbc()}
	DES3_CFB = CipherSpec{0: C.EVP_des_ede3_cfb()}
	DES3_OFB = CipherSpec{0: C.EVP_des_ede3_ofb()}
)
View Source
var (
	DH   = dhParameters{/* contains filtered or unexported fields */}
	ECDH = dhParameters{/* contains filtered or unexported fields */}
)
View Source
var (
	DSA_SHA1   = dsaParameters{C.EVP_sha1()}
	DSA_SHA224 = dsaParameters{C.EVP_sha224()}
	DSA_SHA256 = dsaParameters{C.EVP_sha256()}
	DSA_SHA384 = dsaParameters{C.EVP_sha384()}
	DSA_SHA512 = dsaParameters{C.EVP_sha512()}
)
View Source
var (
	MD4       = HashSpec{C.EVP_md4()}
	MD5       = HashSpec{C.EVP_md5()}
	SHA1      = HashSpec{C.EVP_sha1()}
	SHA224    = HashSpec{C.EVP_sha224()}
	SHA256    = HashSpec{C.EVP_sha256()}
	SHA384    = HashSpec{C.EVP_sha384()}
	SHA512    = HashSpec{C.EVP_sha512()}
	RIPEMD160 = HashSpec{C.EVP_ripemd160()}
)
View Source
var (
	RSA            = rsaParameters{C.RSA_PKCS1_PADDING, nil}
	RSA_OAEP       = rsaParameters{C.RSA_PKCS1_OAEP_PADDING, nil}
	RSA_MD5        = rsaParameters{C.RSA_PKCS1_PADDING, C.EVP_md5()}
	RSA_SHA1       = rsaParameters{C.RSA_PKCS1_PADDING, C.EVP_sha1()}
	RSA_SHA224     = rsaParameters{C.RSA_PKCS1_PADDING, C.EVP_sha224()}
	RSA_SHA256     = rsaParameters{C.RSA_PKCS1_PADDING, C.EVP_sha256()}
	RSA_SHA384     = rsaParameters{C.RSA_PKCS1_PADDING, C.EVP_sha384()}
	RSA_SHA512     = rsaParameters{C.RSA_PKCS1_PADDING, C.EVP_sha512()}
	RSA_PSS_MD5    = rsaParameters{C.RSA_PKCS1_PSS_PADDING, C.EVP_md5()}
	RSA_PSS_SHA1   = rsaParameters{C.RSA_PKCS1_PSS_PADDING, C.EVP_sha1()}
	RSA_PSS_SHA224 = rsaParameters{C.RSA_PKCS1_PSS_PADDING, C.EVP_sha224()}
	RSA_PSS_SHA256 = rsaParameters{C.RSA_PKCS1_PSS_PADDING, C.EVP_sha256()}
	RSA_PSS_SHA384 = rsaParameters{C.RSA_PKCS1_PSS_PADDING, C.EVP_sha384()}
	RSA_PSS_SHA512 = rsaParameters{C.RSA_PKCS1_PSS_PADDING, C.EVP_sha512()}
)
View Source
var (
	DefaultRandom = RandomSpec{}
)
View Source
var (
	HMAC = MACSpec{}
)

Functions

This section is empty.

Types

type Cipher

type Cipher struct {
	// contains filtered or unexported fields
}

func (*Cipher) BlockSize

func (c *Cipher) BlockSize() int

func (*Cipher) BufferedSize

func (c *Cipher) BufferedSize() int

func (*Cipher) Close

func (c *Cipher) Close()

func (*Cipher) Finish

func (c *Cipher) Finish(out []byte) int

func (*Cipher) GCMGetTag

func (c *Cipher) GCMGetTag(out []byte) int

func (*Cipher) GCMSetTag

func (c *Cipher) GCMSetTag(in []byte) int

func (*Cipher) KeySize

func (c *Cipher) KeySize() int

func (*Cipher) Update

func (c *Cipher) Update(in, out []byte) (int, int)

type CipherSpec

type CipherSpec map[int]*C.EVP_CIPHER

CipherSpec represents a cipher algorithm. Different map entries correspond to implementations for different key sizes. Variable key size algorithms have single map entry with key 0.

func (CipherSpec) New

func (cs CipherSpec) New(key, iv []byte, encrypt bool) okapi.Cipher

func (CipherSpec) NewReader

func (cs CipherSpec) NewReader(in io.Reader, key, iv, buffer []byte) *okapi.CipherReader

func (CipherSpec) NewWriter

func (cs CipherSpec) NewWriter(out io.Writer, key, iv, buffer []byte) *okapi.CipherWriter

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

func (*Hash) BlockSize

func (h *Hash) BlockSize() int

func (*Hash) Clone

func (h *Hash) Clone() okapi.Hash

func (*Hash) Close

func (h *Hash) Close()

func (*Hash) Digest

func (h *Hash) Digest() []byte

func (*Hash) Reset

func (h *Hash) Reset()

func (*Hash) Size

func (h *Hash) Size() int

func (*Hash) Write

func (h *Hash) Write(data []byte) (int, error)

type HashSpec

type HashSpec struct {
	// contains filtered or unexported fields
}

func (HashSpec) New

func (hs HashSpec) New() okapi.Hash

type MACSpec

type MACSpec struct{}

func (MACSpec) New

func (ms MACSpec) New(hs okapi.HashSpec, key []byte) okapi.Hash

type PKey

type PKey struct {
	// contains filtered or unexported fields
}

func NewPKey

func NewPKey(kps interface{}, aps algorithmParameters) (key *PKey, err error)

func (*PKey) Close

func (key *PKey) Close()

func (*PKey) Decrypt

func (key *PKey) Decrypt(encrypted []byte) (decrypted []byte, err error)

func (*PKey) Derive

func (key *PKey) Derive(peer okapi.PublicKey) (secret []byte, err error)

func (*PKey) Encrypt

func (key *PKey) Encrypt(plain []byte) (encrypted []byte, err error)

func (*PKey) KeySize

func (key *PKey) KeySize() int

func (*PKey) PublicKey

func (key *PKey) PublicKey() okapi.PublicKey

func (*PKey) Sign

func (key *PKey) Sign(digest []byte) (signature []byte, err error)

func (*PKey) Verify

func (key *PKey) Verify(signature []byte, digest []byte) (valid bool, err error)

type Random

type Random struct {
}

func (*Random) Close

func (r *Random) Close()

func (*Random) Read

func (r *Random) Read(b []byte) (int, error)

type RandomSpec

type RandomSpec struct{}

func (RandomSpec) New

func (rs RandomSpec) New() okapi.Random

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL