decrypt

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: GPL-3.0, GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlobPieceSize is a specific size used by Signal for Android, and if you don't match it, your mac will be messed up.
	// Source: https://github.com/signalapp/Signal-Android/blob/7fc9876b1ea88ff1893ef627d1ecf0d2c2913508/app/src/main/java/org/thoughtcrime/securesms/backup/FullBackupImporter.java#L368
	BlobPieceSize = 8192

	// DigestIterations is how many times to perform a SHA512 digest on a user's password. Must be the same as the number Signal for Android uses.
	// Source: https://github.com/signalapp/Signal-Android/blob/8d4419705bbb3ab6b2bec5c85a9e3de806723dd6/app/src/main/java/org/thoughtcrime/securesms/backup/FullBackupBase.java#L15
	DigestIterations = 250000

	// MACSize is the length every MAC is truncated down to. Must be the same size as in Signal for Android.
	// Source: https://github.com/signalapp/Signal-Android/blob/4e01336b2f9aff2e727046132bac3d582e7f6e0c/app/src/main/java/org/thoughtcrime/securesms/backup/FullBackupExporter.java#L683
	MACSize = 10
)

Variables

View Source
var HKDFInfo = []byte("Backup Export")

HKDFInfo is used to build an HKDF from which the cipher key and MAC key can be extracted - must be the same as Signal for Android. Source: https://github.com/signalapp/Signal-Android/blob/4e01336b2f9aff2e727046132bac3d582e7f6e0c/app/src/main/java/org/thoughtcrime/securesms/backup/FullBackupExporter.java#L546

Functions

func AddToUint32Bytes

func AddToUint32Bytes(b []byte, val uint32)

func DeriveSecrets

func DeriveSecrets(password string, salt []byte) (cipherKey []byte, macKey []byte, err error)

func NextAESCTRCipher

func NextAESCTRCipher(cipherKey []byte, iv []byte) (cipher.Stream, error)

Types

type BackupFile

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

func NewBackupFile

func NewBackupFile(file io.Reader, password string, encoder frameio.Encoder) (*BackupFile, error)

NewBackupFile allows reading decrypted backup frames from encrypted data in an io.Reader. Not thread-safe.

func (*BackupFile) Read

func (bf *BackupFile) Read(backupFrame *signal.BackupFrame, blob *[]byte) error

Read reads a frame of the backup. Not thread-safe, reads from the io.Reader originally provided

Jump to

Keyboard shortcuts

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