Documentation ¶
Overview ¶
Copyright 2019 The Swarm Authors This file is part of the Swarm library.
The Swarm library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Swarm library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Swarm library. If not, see <http://www.gnu.org/licenses/>.
Index ¶
Constants ¶
const (
SizeMask = byte(3) // mask used to extract the size of payload size field from the flags
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type KeyStore ¶
type KeyStore interface { // Symmetric key management GetSymmetricKey(id string) ([]byte, error) GenerateSymmetricKey() (string, error) AddSymmetricKey(bytes []byte) (string, error) // Key serialization SerializePublicKey(pub *ecdsa.PublicKey) []byte UnmarshalPublicKey(pub []byte) (*ecdsa.PublicKey, error) CompressPublicKey(pub *ecdsa.PublicKey) []byte }
KeyStore contains key manipulation methods
type Message ¶
type Message interface { Wrap(plaintext []byte, params *WrapParams) (data []byte, err error) UnWrap(ciphertext []byte, unwrapParams *UnwrapParams) (ReceivedMessage, error) }
Message contains methods for wrapping(encrypting) and unwrapping(decrypting) messages
type ReceivedMessage ¶
Contains a successfully decrypted message prior to parsing and validating
type UnwrapParams ¶
type UnwrapParams struct { Sender *ecdsa.PublicKey // Public key of sender used for signature validation Receiver *ecdsa.PrivateKey // Private key of receiver for decryption SymmetricKey []byte // Symmetric key for decryption }
Config params to unwrap and decrypt a message. For asymmetric encryption Receiver is needed. For symmetric, SymmetricKey is needed. Sender is not mandatory but used to sign the message in both schemes.
type WrapParams ¶
type WrapParams struct { Sender *ecdsa.PrivateKey // Private key of sender used for signature Receiver *ecdsa.PublicKey // Public key of receiver for encryption SymmetricKey []byte // Symmetric key for encryption }
Config params to wrap and encrypt a message. For asymmetric encryption Receiver is needed. For symmetric, SymmetricKey is needed. Sender is not mandatory but used to sign the message in both schemes.