Documentation ¶
Index ¶
- Constants
- func AES_CTR(key, plaintext []byte) ([]byte, error)
- func BytesToString(b []byte) string
- func GenerateKeyPair() ([]byte, []byte, error)
- func Hmac(key, message []byte) []byte
- func KDF(key []byte) []byte
- func ProcessSphinxHeader(packet Header, privKey []byte) (Hop, Commands, Header, error)
- func ProcessSphinxPacket(packetBytes []byte, privKey []byte) (Hop, Commands, []byte, error)
- func ProcessSphinxPayload(alpha []byte, payload []byte, privKey []byte) ([]byte, error)
- func XorBytes(b1, b2 []byte) []byte
Constants ¶
const ( K = 16 R = 5 )
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
func GenerateKeyPair ¶
func ProcessSphinxHeader ¶
ProcessSphinxHeader unwraps one layer of encryption from the header of a sphinx packet. ProcessSphinxHeader recomputes the shared key and checks whether the message authentication code is valid. If not, the packet is dropped and error is returned. If MAC checking was passed successfully ProcessSphinxHeader performs the AES_CTR decryption, recomputes the blinding factor and updates the init public element from the header. Next, ProcessSphinxHeader extracts the routing information from the decrypted packet and returns it, together with the updated init public element. If any crypto or parsing operation failed ProcessSphinxHeader returns an error.
func ProcessSphinxPacket ¶
ProcessSphinxPacket processes the sphinx packet using the given private key. ProcessSphinxPacket unwraps one layer of both the header and the payload encryption. ProcessSphinxPacket returns a new packet and the routing information which should be used by the processing node. If any cryptographic or parsing operation failed ProcessSphinxPacket returns an error.
func ProcessSphinxPayload ¶
ProcessSphinxPayload unwraps a single layer of the encryption from the sphinx packet payload. ProcessSphinxPayload first recomputes the shared secret which is used to perform the AES_CTR decryption. ProcessSphinxPayload returns the new packet payload or an error if the decryption failed.
Types ¶
This section is empty.