Documentation ¶
Index ¶
- Constants
- type New
- type Packet
- func (p *Packet) AddEncryptionData(ciphertext []byte) error
- func (p *Packet) AddSignature(signature []byte) error
- func (p *Packet) Encrypt_RSA_2048_With_AES_256_CBC(pubKey *rsa.PublicKey) error
- func (p *Packet) EncryptionPlaintext() ([]byte, error)
- func (p *Packet) Export() ([]byte, error)
- func (p *Packet) Sign_RSA_SHA256(privKey *rsa.PrivateKey) error
- func (p *Packet) SignatureData() ([]byte, error)
Constants ¶
View Source
const ( PacketPayloadSize = 16 // bytes MaxSize = 1232 // bytes )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Packet ¶
type Packet struct { Header header.Header Payload packetPayload Signature []byte ByteData []byte // header + payload encoded Encrypted []byte }
func Decode ¶
func Decode(data []byte, privKey *rsa.PrivateKey) (Packet, error)
Decodes an encrypted OpenSPA response packet and returns a Packet struct. If we are unable to decode the packet we will return an error.
func (*Packet) AddEncryptionData ¶
Adds encrypted data to the packet.
func (*Packet) AddSignature ¶
Adds to a packet the callers packet signature
func (*Packet) Encrypt_RSA_2048_With_AES_256_CBC ¶
Encrypts the byte data using 2048 bit RSA with AES 256-bit CBC mode and adds it to the packet.
func (*Packet) EncryptionPlaintext ¶
Returns the plaintext that we will encrypt.
func (*Packet) Sign_RSA_SHA256 ¶
func (p *Packet) Sign_RSA_SHA256(privKey *rsa.PrivateKey) error
Signs the packet using a RSA private key, by taking a SHA-256 digest of the packet signature data.
func (*Packet) SignatureData ¶
Returns the signature data to sign (header+payload).
Click to show internal directories.
Click to hide internal directories.