airdispatch-go: github.com/airdispatch/airdispatch-go/crypto Index | Files

package crypto

import "github.com/airdispatch/airdispatch-go/crypto"

This package implements helper methods to be used by the AirDispatch system to take care of all encryption needs. It is split into files based on the types of crypto included.

--- Crypto | - Constants = Constants used for Encoding and Decoding | - Crypto = Methods needed for all Crypto Files | - Encoding = Encoding Keys to Binary (and back again) | - Encryption = AES Encryption and Decryption | - Hash = SHA256 Hashing | - Signatures = ECDSA Signing

Index

Package Files

constants.go crypto.go doc.go encoding.go encryption.go hash.go signatures.go

Variables

var AESKeySize int = 256
var ECDSAPrefix = []byte{3}
var EllipticCurve elliptic.Curve = elliptic.P256()
var EncryptionNone = []byte{0, 0} // "airdispat.ch/crypto/none"

Seperate Encryption Types

var EncryptionRSA = []byte{1, 1} // "airdispat.ch/crypto/rsa2048-aes256"
var RSAPrefix = []byte("AD-RSA")
var Random = rand.Reader
var SigningECDSA = []byte{0}

Seperate Signing Types

func BytesToAddress Uses

func BytesToAddress(toHash []byte) []byte

func BytesToKey Uses

func BytesToKey(data []byte) (*ecdsa.PublicKey, error)

This function creates an ECDSA Public KEy from a bytestring. This is used to send the public key in the SignedMessage message.

func BytesToRSA Uses

func BytesToRSA(data []byte) (*rsa.PublicKey, error)

func EncryptDataWithRandomAESKey Uses

func EncryptDataWithRandomAESKey(plaintext []byte) (aesCipher []byte, unencryptedKey AESKey, err error)

func HashRIP Uses

func HashRIP(payload []byte) []byte

Encapsulation for the RIPEMD160 Hasher

func HashSHA Uses

func HashSHA(payload []byte) []byte

Encapsulation for the SHA Hasher

func HybridDecryption Uses

func HybridDecryption(rsaKey *rsa.PrivateKey, encryptedAesKey []byte, ciphertext []byte) (plaintext []byte, error error)

func KeyToBytes Uses

func KeyToBytes(key *ecdsa.PublicKey) []byte

This function writes an ECDSA Public Key to a bytestring. This is used to send the public key in the SignedMessage message.

func RSAToBytes Uses

func RSAToBytes(key *rsa.PublicKey) []byte

func SignPayload Uses

func SignPayload(key *ecdsa.PrivateKey, payload []byte) (r, s *big.Int, err error)

Encapsulates ECDSA Signature Generation

func VerifyPayload Uses

func VerifyPayload(key *ecdsa.PublicKey, payload []byte, r, s *big.Int) bool

Encapsulates ECDSA Signature Verification

func VerifyStringAddress Uses

func VerifyStringAddress(address string) bool

Hex decode an Address then verify that it is correct, then pass it to the byte verification function

type AESKey Uses

type AESKey []byte

type EncryptedAESKey Uses

type EncryptedAESKey []byte

func EncryptAESKey Uses

func EncryptAESKey(a AESKey, b *rsa.PublicKey) (EncryptedAESKey, error)

Package crypto imports 14 packages (graph). Updated 2016-07-15. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).