crypto

package
v0.0.0-...-1149b08 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2015 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcModulusBitLen

func CalcModulusBitLen(msgbitlen int) int

CalcModulusLen returns the minimum RSA public modulus length, required for encrypting a message with size msgbitlen bits, using the EncryptShortMsg routine.

func DecipherMsg

func DecipherMsg(ciphertext []byte, privkey *CipherMsgKey) ([]byte, os.Error)

func DecryptShortMsg

func DecryptShortMsg(privkey *rsa.PrivateKey, ciphertext, label []byte) (plaintext []byte, err os.Error)

func EncipherMsg

func EncipherMsg(plaintext []byte, pubkey *CipherMsgPubKey) ([]byte, os.Error)

Encipher a message

func EncryptShortMsg

func EncryptShortMsg(pubkey *rsa.PublicKey, plaintext, label []byte) (ciphertext []byte, err os.Error)

func GetUrandom

func GetUrandom() (r io.Reader, err os.Error)

func NewRand

func NewRand() *rand.Rand

Types

type CipherMsgKey

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

CipherMsgKey

func GenerateCipherMsgKey

func GenerateCipherMsgKey() *CipherMsgKey

func ParseCipherMsgKey

func ParseCipherMsgKey(s string) (k *CipherMsgKey, err os.Error)

TODO: Add length checks

func (*CipherMsgKey) PubKey

func (cmk *CipherMsgKey) PubKey() *CipherMsgPubKey

func (*CipherMsgKey) String

func (cmk *CipherMsgKey) String() string

type CipherMsgPubKey

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

CipherMsgPubKey

func ParseCipherMsgPubKey

func ParseCipherMsgPubKey(s string) (k *CipherMsgPubKey, err os.Error)

TODO: Add length checks

func (*CipherMsgPubKey) String

func (cmpk *CipherMsgPubKey) String() string

type OnesReader

type OnesReader struct{}

Reader that always returns one

func (OnesReader) Read

func (OnesReader) Read(p []byte) (n int, err os.Error)

type TimedRC4Rand

type TimedRC4Rand struct {
	*rc4.Cipher
}

Random source using RC4, keyed by time

func NewTimedRC4Rand

func NewTimedRC4Rand() TimedRC4Rand

func (TimedRC4Rand) Read

func (tr TimedRC4Rand) Read(p []byte) (n int, err os.Error)

type TimedRand

type TimedRand struct {
	*rand.Rand
}

Random source using Go's rand, keyed by time

func NewTimedRand

func NewTimedRand() TimedRand

func (TimedRand) Read

func (tr TimedRand) Read(p []byte) (n int, err os.Error)

type U_CipherMsg

type U_CipherMsg struct {
	Seed []byte // RSA-encrypted Seed for the RC4 cipher
	Text []byte // Plaintext, encrypted using RC4 seeded by Seed
}

Jump to

Keyboard shortcuts

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