messages/crypto.go
func ClientOpen(c, agentPub []byte, clientPrv *ecdsa.PrivateKey) ([]byte, error) {
	sealed, sig := UnpackSignature(c)
	hash := ethcrypto.Keccak256(sealed)

	if !VerifySignature(agentPub, hash, sig) {
		return nil, ErrWrongSignature
	}

	prv := ecies.ImportECDSA(clientPrv)

	opened, err := prv.Decrypt(sealed, nil, nil)
	if err != nil {
		return nil, err
	}

	return opened, nil
}
func ClientOpen(c, agentPub []byte, clientPrv *ecdsa.PrivateKey) ([]byte, error) {
	sealed, sig := UnpackSignature(c)
	hash := ethcrypto.Keccak256(sealed)

	if !VerifySignature(agentPub, hash, sig) {
		return nil, ErrWrongSignature
	}

	prv := ecies.ImportECDSA(clientPrv)

	opened, err := prv.Decrypt(sealed, nil, nil)
	if err != nil {
		return nil, err
	}

	return opened, nil
}
func ClientOpen ( c , agentPub [ ] byte , clientPrv * ecdsa . PrivateKey ) ( [ ] byte , error ) { sealed , sig := UnpackSignature ( c ) hash := ethcrypto . Keccak256 ( sealed ) if ! VerifySignature ( agentPub , hash , sig ) { return nil , ErrWrongSignature } prv := ecies . ImportECDSA ( clientPrv ) opened , err := prv . Decrypt ( sealed , nil , nil ) if err != nil { return nil , err } return opened , nil }
// ClientOpen decrypts message using client's key and verifies using agent's key.
ClientOpen decrypts message using client s key and verifies using agent s key .