Documentation
¶
Overview ¶
Package crypto provides cryptographic primitives for the GOProto implementation.
Package crypto provides cryptographic primitives for the GOProto implementation.
Package crypto provides cryptographic primitives for the GOProto implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthKey ¶
AuthKey computes the authentication key from a shared secret. This is a simplified version - in practice, this would involve more steps.
func GenerateRandomIV ¶
GenerateRandomIV generates a random IV for AES-IGE encryption.
func MessageKey ¶
MessageKey calculates the message key as used in GOProto. It's the SHA-1 hash of a portion of the encrypted message.
Types ¶
type DiffieHellman ¶
type DiffieHellman struct {
// contains filtered or unexported fields
}
DiffieHellman represents a Diffie-Hellman key exchange instance.
func NewDiffieHellman ¶
func NewDiffieHellman() *DiffieHellman
NewDiffieHellman creates a new Diffie-Hellman instance with a predefined prime and generator. Uses a 2048-bit prime similar to RFC 3526 Group 14.
func (*DiffieHellman) ComputeSharedSecret ¶
func (dh *DiffieHellman) ComputeSharedSecret(theirPublicKey *big.Int) *big.Int
ComputeSharedSecret computes the shared secret using our private key and their public key.
func (*DiffieHellman) GenerateKeys ¶
func (dh *DiffieHellman) GenerateKeys() error
GenerateKeys generates a new private and public key pair.
func (*DiffieHellman) GetGenerator ¶
func (dh *DiffieHellman) GetGenerator() int64
GetGenerator returns the generator used in the Diffie-Hellman exchange.
func (*DiffieHellman) GetPrime ¶
func (dh *DiffieHellman) GetPrime() *big.Int
GetPrime returns the prime used in the Diffie-Hellman exchange.
func (*DiffieHellman) GetPublicKey ¶
func (dh *DiffieHellman) GetPublicKey() *big.Int
GetPublicKey returns the public key.