crypto

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

README

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

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 EncryptSecret

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

func GeneratePublicRandomness

func GeneratePublicRandomness() ([]byte, error)

GeneratePublicRandomness - generate 32 bytes of randomness, which will be exposed in the rollup header.

func GetObscuroKey

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

func PerTransactionRnd

func PerTransactionRnd(privateRnd []byte, tCount int) []byte

PerTransactionRnd - calculates a per tx random value

func PrivateRollupRnd

func PrivateRollupRnd(publicRnd []byte, secret []byte) []byte

PrivateRollupRnd - combine public randomness with private randomness in a way that protects the secret.

Types

type SharedEnclaveSecret

type SharedEnclaveSecret [sharedSecretLen]byte

SharedEnclaveSecret - the entropy

func GenerateEntropy

func GenerateEntropy(logger gethlog.Logger) SharedEnclaveSecret

type TransactionBlobCrypto

type TransactionBlobCrypto interface {
	Encrypt(transactions []*common.L2Tx) common.EncryptedTransactions
	Decrypt(encryptedTxs common.EncryptedTransactions) []*common.L2Tx
}

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

func NewTransactionBlobCryptoImpl

func NewTransactionBlobCryptoImpl(logger gethlog.Logger) TransactionBlobCrypto

type TransactionBlobCryptoImpl

type TransactionBlobCryptoImpl struct {
	// contains filtered or unexported fields
}

func (TransactionBlobCryptoImpl) Decrypt

func (TransactionBlobCryptoImpl) Encrypt

todo (#1053) - modify this logic so that transactions with different reveal periods are in different blobs, as per the whitepaper.

Jump to

Keyboard shortcuts

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