aes

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 16

BlockSize is the AES block size in bytes (128 bits)

Variables

This section is empty.

Functions

func EncryptedSize

func EncryptedSize(fileSize int64) int64

EncryptedSize calculates the encrypted size for a given plaintext size. AES-CBC pads data to 16-byte block boundary.

Types

type AesCipher

type AesCipher struct{}

AesCipher handles AES-CBC decryption for encrypted archives Used for password-protected RAR, 7z, and other AES-encrypted archive formats

func NewAesCipher

func NewAesCipher() *AesCipher

NewAesCipher creates a new AES cipher

func (*AesCipher) DecryptedSize

func (c *AesCipher) DecryptedSize(encryptedFileSize int64) (int64, error)

DecryptedSize calculates the decrypted size from encrypted size

func (*AesCipher) EncryptedSize

func (c *AesCipher) EncryptedSize(fileSize int64) int64

EncryptedSize calculates the encrypted size for a given plaintext size

func (*AesCipher) Open

func (c *AesCipher) Open(
	ctx context.Context,
	rh *utils.RangeHeader,
	decryptedFileSize int64,
	key []byte,
	iv []byte,
	getReader func(ctx context.Context, start, end int64) (io.ReadCloser, error),
) (io.ReadCloser, error)

Open creates a decrypting reader for AES-encrypted data decryptedFileSize is the actual file size (output will be limited to this)

func (*AesCipher) OverheadSize

func (c *AesCipher) OverheadSize(fileSize int64) int64

OverheadSize returns the encryption overhead for AES-CBC AES-CBC has minimal overhead (padding to block size)

Jump to

Keyboard shortcuts

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