crypto

package
v0.20.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

README

This package contains logic which implements the cryptographic requirements of Ten.

Documentation

Index

Constants

View Source
const (
	// RollupEncryptionKeyHex is the AES key used to encrypt and decrypt the transaction blob in rollups.
	// todo (#1053) - replace this fixed key with derived, rotating keys.
	RollupEncryptionKeyHex = "bddbc0d46a0666ce57a466168d99c1830b0c65e052d77188f2cbfc3f6486588c"
	// NonceLength is the nonce's length in bytes for encrypting and decrypting transactions.
	NonceLength = 12
)

Variables

This section is empty.

Functions

func CalculateRootBatchEntropy

func CalculateRootBatchEntropy(rootEntropy []byte, batchHeight *big.Int) gethcommon.Hash

CalculateRootBatchEntropy - calculates entropy per batch In Obscuro, we use a root entropy per batch, which is then used to calculate randomness exposed to individual transactions The RootBatchEntropy is calculated based on the shared secret and the batch height This ensures that sibling batches will naturally use the same root entropy so that transactions will have the same results Note that this formula is vulnerable to the unlikely event of a secret leak. todo (crypto) - find a way to hash in timestamp or something else then it would make it harder for attacker, such that sibling batches naturally have the same entropy.

func CalculateTxRnd

func CalculateTxRnd(rootBatchEntropy []byte, tCount int) gethcommon.Hash

CalculateTxRnd - calculates the randomness exposed to individual transactions In Obscuro, each tx must have its own randomness, independent from the others, because otherwise a malicious transaction could reveal information.

func EncryptSecret

func EncryptSecret(pubKeyEncoded []byte, secret SharedEnclaveSecret, logger gethlog.Logger) (common.EncryptedSharedEnclaveSecret, error)

func GetObscuroKey

func GetObscuroKey(logger gethlog.Logger) *ecdsa.PrivateKey

Types

type DataEncryptionService

type DataEncryptionService interface {
	Encrypt(blob []byte) ([]byte, error)
	Decrypt(blob []byte) ([]byte, error)
}

DataEncryptionService handles the encryption and decryption of the transaction blobs stored inside a rollup.

func NewDataEncryptionService

func NewDataEncryptionService(logger gethlog.Logger) DataEncryptionService

type SharedEnclaveSecret

type SharedEnclaveSecret [sharedSecretLen]byte

SharedEnclaveSecret - the entropy

func GenerateEntropy

func GenerateEntropy(logger gethlog.Logger) SharedEnclaveSecret

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL