Documentation
¶
Overview ¶
package for i2p specific crpytography
Index ¶
- Constants
- Variables
- func ElgamalGenerate(priv *elgamal.PrivateKey, rand io.Reader) (err error)
- type DSAPrivateKey
- type DSAPublicKey
- type DSASigner
- type DSAVerifier
- type Decrypter
- type ECDSAVerifier
- type ECP256PrivateKey
- type ECP256PublicKey
- type ECP384PrivateKey
- type ECP384PublicKey
- type ECP521PrivateKey
- type ECP521PublicKey
- type Ed25519PrivateKey
- type Ed25519PublicKey
- type Ed25519Signer
- type Ed25519Verifier
- type ElgPrivateKey
- type ElgPublicKey
- type ElgamalEncryption
- type Encrypter
- type HMACDigest
- type HMACKey
- type PrivateEncryptionKey
- type PublicEncryptionKey
- type PublicKey
- type RSA2048PrivateKey
- type RSA2048PublicKey
- type RSA3072PrivateKey
- type RSA3072PublicKey
- type RSA4096PrivateKey
- type RSA4096PublicKey
- type Signer
- type SigningPrivateKey
- type SigningPublicKey
- type Tunnel
- type TunnelData
- type TunnelIV
- type TunnelKey
- type Verifier
Constants ¶
View Source
const IPAD = byte(0x36)
View Source
const OPAD = byte(0x5C)
Variables ¶
View Source
var ElgDecryptFail = errors.New("failed to decrypt elgamal encrypted data")
View Source
var ElgEncryptTooBig = errors.New("failed to encrypt data, too big for elgamal")
View Source
var ErrBadSignatureSize = errors.New("bad signature size")
View Source
var ErrInvalidKeyFormat = errors.New("invalid key format")
View Source
var ErrInvalidSignature = errors.New("invalid signature")
View Source
var SHA256 = sha256.Sum256
Functions ¶
func ElgamalGenerate ¶
func ElgamalGenerate(priv *elgamal.PrivateKey, rand io.Reader) (err error)
generate an elgamal key pair
Types ¶
type DSAPrivateKey ¶
type DSAPrivateKey [20]byte
func (DSAPrivateKey) Generate ¶
func (k DSAPrivateKey) Generate() (s DSAPrivateKey, err error)
func (DSAPrivateKey) Len ¶
func (k DSAPrivateKey) Len() int
func (DSAPrivateKey) NewSigner ¶
func (k DSAPrivateKey) NewSigner() (s Signer, err error)
create a new dsa signer
func (DSAPrivateKey) Public ¶
func (k DSAPrivateKey) Public() (pk DSAPublicKey, err error)
type DSAPublicKey ¶
type DSAPublicKey [128]byte
func (DSAPublicKey) Len ¶
func (k DSAPublicKey) Len() int
func (DSAPublicKey) NewVerifier ¶
func (k DSAPublicKey) NewVerifier() (v Verifier, err error)
create a new dsa verifier
type DSAVerifier ¶
type DSAVerifier struct {
// contains filtered or unexported fields
}
func (*DSAVerifier) Verify ¶
func (v *DSAVerifier) Verify(data, sig []byte) (err error)
verify data with a dsa public key
func (*DSAVerifier) VerifyHash ¶
func (v *DSAVerifier) VerifyHash(h, sig []byte) (err error)
verify hash of data with a dsa public key
type Decrypter ¶
type Decrypter interface { // decrypt a block of data // return decrypted block or nil and error if error happens Decrypt(data []byte) ([]byte, error) }
decrypts data
type ECDSAVerifier ¶
type ECDSAVerifier struct {
// contains filtered or unexported fields
}
func (*ECDSAVerifier) Verify ¶
func (v *ECDSAVerifier) Verify(data, sig []byte) (err error)
verify a block of data by hashing it and comparing the hash against the signature
func (*ECDSAVerifier) VerifyHash ¶
func (v *ECDSAVerifier) VerifyHash(h, sig []byte) (err error)
verify a signature given the hash
type ECP256PrivateKey ¶
type ECP256PrivateKey [32]byte
type ECP256PublicKey ¶
type ECP256PublicKey [64]byte
func (ECP256PublicKey) Len ¶
func (k ECP256PublicKey) Len() int
func (ECP256PublicKey) NewVerifier ¶
func (k ECP256PublicKey) NewVerifier() (Verifier, error)
type ECP384PrivateKey ¶
type ECP384PrivateKey [48]byte
type ECP384PublicKey ¶
type ECP384PublicKey [96]byte
func (ECP384PublicKey) Len ¶
func (k ECP384PublicKey) Len() int
func (ECP384PublicKey) NewVerifier ¶
func (k ECP384PublicKey) NewVerifier() (Verifier, error)
type ECP521PrivateKey ¶
type ECP521PrivateKey [66]byte
type ECP521PublicKey ¶
type ECP521PublicKey [132]byte
func (ECP521PublicKey) Len ¶
func (k ECP521PublicKey) Len() int
func (ECP521PublicKey) NewVerifier ¶
func (k ECP521PublicKey) NewVerifier() (Verifier, error)
type Ed25519PrivateKey ¶
type Ed25519PrivateKey [32]byte
type Ed25519PublicKey ¶
type Ed25519PublicKey [32]byte
func (Ed25519PublicKey) NewVerifier ¶
func (k Ed25519PublicKey) NewVerifier() (v Verifier, err error)
type Ed25519Signer ¶
type Ed25519Signer struct {
// contains filtered or unexported fields
}
type Ed25519Verifier ¶
type Ed25519Verifier struct {
// contains filtered or unexported fields
}
func (*Ed25519Verifier) Verify ¶
func (v *Ed25519Verifier) Verify(data, sig []byte) (err error)
func (*Ed25519Verifier) VerifyHash ¶
func (v *Ed25519Verifier) VerifyHash(h, sig []byte) (err error)
type ElgPrivateKey ¶
type ElgPrivateKey [256]byte
func (ElgPrivateKey) Len ¶
func (elg ElgPrivateKey) Len() int
func (ElgPrivateKey) NewDecrypter ¶
func (elg ElgPrivateKey) NewDecrypter() (dec Decrypter, err error)
type ElgPublicKey ¶
type ElgPublicKey [256]byte
func (ElgPublicKey) Len ¶
func (elg ElgPublicKey) Len() int
func (ElgPublicKey) NewEncrypter ¶
func (elg ElgPublicKey) NewEncrypter() (enc Encrypter, err error)
type ElgamalEncryption ¶
type ElgamalEncryption struct {
// contains filtered or unexported fields
}
func (*ElgamalEncryption) Encrypt ¶
func (elg *ElgamalEncryption) Encrypt(data []byte) (enc []byte, err error)
func (*ElgamalEncryption) EncryptPadding ¶
func (elg *ElgamalEncryption) EncryptPadding(data []byte, zeroPadding bool) (encrypted []byte, err error)
type Encrypter ¶
type Encrypter interface { // encrypt a block of data // return encrypted block or nil and error if an error happened Encrypt(data []byte) (enc []byte, err error) }
encrypts data
type HMACDigest ¶
type HMACDigest [16]byte
type PrivateEncryptionKey ¶
type PublicEncryptionKey ¶
type RSA2048PrivateKey ¶
type RSA2048PrivateKey [512]byte
type RSA2048PublicKey ¶
type RSA2048PublicKey [256]byte
type RSA3072PrivateKey ¶
type RSA3072PrivateKey [786]byte
type RSA3072PublicKey ¶
type RSA3072PublicKey [384]byte
type RSA4096PrivateKey ¶
type RSA4096PrivateKey [1024]byte
type RSA4096PublicKey ¶
type RSA4096PublicKey [512]byte
type Signer ¶
type Signer interface { // sign data with our private key by calling SignHash after hashing the data we are given // return signature or nil signature and error if an error happened Sign(data []byte) (sig []byte, err error) // sign hash of data with our private key // return signature or nil signature and error if an error happened SignHash(h []byte) (sig []byte, err error) }
type for signing data
type SigningPrivateKey ¶
type SigningPrivateKey interface { // create a new signer to sign data // return signer or nil and error if key format is invalid NewSigner() (Signer, error) // length of this private key Len() int // get public key or return nil and error if invalid key data in private key Public() (SigningPublicKey, error) // generate a new private key, put it into itself // returns itself or nil and error if an error occurs Generate() (SigningPrivateKey, error) }
key for signing data
type SigningPublicKey ¶
type SigningPublicKey interface { // create new Verifier to verify the validity of signatures // return verifier or nil and error if key format is invalid NewVerifier() (Verifier, error) // get the size of this public key Len() int }
key for verifying data
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
func NewTunnelCrypto ¶
func (*Tunnel) Decrypt ¶
func (t *Tunnel) Decrypt(td *TunnelData)
type TunnelData ¶
type TunnelData [1028]byte
type Verifier ¶
type Verifier interface { // verify hashed data with this signing key // return nil on valid signature otherwise error VerifyHash(h, sig []byte) error // verify an unhashed piece of data by hashing it and calling VerifyHash Verify(data, sig []byte) error }
type for verifying signatures
Click to show internal directories.
Click to hide internal directories.