Metadata-Version: 2.4
Name: swe-ai-agent
Version: 1.0.75
Summary: SWE Agent - Headless Agentic IDE with comprehensive tool support
Project-URL: Homepage, https://github.com/harishsg993010/SWE-Agent
Project-URL: Documentation, https://github.com/harishsg993010/SWE-Agent#readme
Project-URL: Repository, https://github.com/harishsg993010/SWE-Agent
Project-URL: Issues, https://github.com/harishsg993010/SWE-Agent/issues
Author-email: Harish SG <harishsg993010@gmail.com>
License-File: LICENSE
Keywords: agent,ai,automation,claude,development,ide,langchain
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Requires-Python: >=3.9
Requires-Dist: aiohttp>=3.8.0
Requires-Dist: anthropic>=0.57.1
Requires-Dist: click>=8.0.0
Requires-Dist: detect-secrets>=1.5.0
Requires-Dist: langchain-anthropic>=0.3.17
Requires-Dist: langchain-core>=0.3.68
Requires-Dist: langchain-mcp-adapters>=0.1.0
Requires-Dist: langchain>=0.3.26
Requires-Dist: langgraph>=0.5.3
Requires-Dist: psutil>=5.8.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pygame>=2.6.1
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: requests>=2.28.0
Requires-Dist: rich>=14.0.0
Requires-Dist: setuptools>=80.9.0
Requires-Dist: twine>=6.1.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: black>=22.0.0; extra == 'dev'
Requires-Dist: flake8>=4.0.0; extra == 'dev'
Requires-Dist: mypy>=0.950; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# AES Encryption in Go

A secure, production-ready AES encryption implementation in Go using AES-GCM mode for authenticated encryption.

## Features

- **Secure**: Uses AES-GCM mode for authenticated encryption
- **Flexible**: Supports AES-128, AES-192, and AES-256
- **Random**: Generates unique nonce for each encryption operation
- **Easy to use**: Simple API for both string and byte encryption
- **Well-tested**: Comprehensive test suite with benchmarks
- **Standards compliant**: Follows Go coding standards and best practices

## Security Features

- **AES-GCM Mode**: Provides both confidentiality and authenticity
- **Random Nonce**: Each encryption uses a cryptographically secure random nonce
- **Key Derivation**: Password-based encryption uses SHA-256 for key derivation
- **Memory Safety**: Keys are copied to prevent external modification
- **Error Handling**: Comprehensive error handling for all failure modes

## Installation

```bash
go mod init your-project
# Copy the aes_encryption.go file to your project
```

## Usage

### Basic String Encryption

```go
package main

import (
    "fmt"
    "log"
)

func main() {
    // Create AES encryption instance with password
    aes := NewAESEncryption("your-secret-password")
    
    // Encrypt a message
    plaintext := "Hello, World! This is a secret message."
    encrypted, err := aes.Encrypt(plaintext)
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Printf("Encrypted: %s\n", encrypted)
    
    // Decrypt the message
    decrypted, err := aes.Decrypt(encrypted)
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Printf("Decrypted: %s\n", decrypted)
}
```

### Key-Based Encryption

```go
// Generate a secure random key
key, err := GenerateKey(32) // 32 bytes = AES-256
if err != nil {
    log.Fatal(err)
}

// Create AES instance with the key
aes, err := NewAESEncryptionWithKey(key)
if err != nil {
    log.Fatal(err)
}

// Use for encryption/decryption
encrypted, err := aes.Encrypt("Secret message")
if err != nil {
    log.Fatal(err)
}
```

### Binary Data Encryption

```go
// Encrypt binary data
data := []byte("Binary data to encrypt")
encrypted, err := aes.EncryptBytes(data)
if err != nil {
    log.Fatal(err)
}

// Decrypt binary data
decrypted, err := aes.DecryptBytes(encrypted)
if err != nil {
    log.Fatal(err)
}
```

## API Reference

### Types

#### `AESEncryption`
Main encryption/decryption struct.

### Functions

#### `NewAESEncryption(password string) *AESEncryption`
Creates a new AES encryption instance using a password. The password is hashed with SHA-256 to create a 256-bit key.

#### `NewAESEncryptionWithKey(key []byte) (*AESEncryption, error)`
Creates a new AES encryption instance with a provided key. Key must be 16, 24, or 32 bytes for AES-128, AES-192, or AES-256 respectively.

#### `GenerateKey(keySize int) ([]byte, error)`
Generates a cryptographically secure random key of the specified size (16, 24, or 32 bytes).

### Methods

#### `Encrypt(plaintext string) (string, error)`
Encrypts a string and returns base64-encoded ciphertext with nonce prepended.

#### `Decrypt(encodedCiphertext string) (string, error)`
Decrypts base64-encoded ciphertext and returns the original plaintext.

#### `EncryptBytes(data []byte) ([]byte, error)`
Encrypts binary data and returns encrypted bytes with nonce prepended.

#### `DecryptBytes(ciphertext []byte) ([]byte, error)`
Decrypts binary data and returns the original bytes.

## Testing

Run the test suite:

```bash
go test -v
```

Run benchmarks:

```bash
go test -bench=.
```

## Security Considerations

1. **Key Management**: Store keys securely and never hardcode them in source code
2. **Password Strength**: Use strong passwords for password-based encryption
3. **Key Rotation**: Regularly rotate encryption keys in production systems
4. **Secure Deletion**: Clear sensitive data from memory when no longer needed
5. **Transport Security**: Use TLS when transmitting encrypted data over networks

## Performance

The implementation is optimized for both security and performance:

- Uses Go's optimized AES implementation
- Minimal memory allocations
- Efficient nonce generation
- Fast base64 encoding/decoding

Typical performance on modern hardware:
- Encryption: ~100MB/s
- Decryption: ~100MB/s

## Error Handling

The library provides detailed error messages for common failure modes:

- Empty plaintext/ciphertext
- Invalid key sizes
- Corrupted ciphertext
- Invalid base64 encoding
- Authentication failures

## License

Licensed under the Apache License, Version 2.0. See the source files for full license text.

## Contributing

1. Follow Go coding standards
2. Add tests for new functionality
3. Run `go fmt` and `go vet` before submitting
4. Ensure all tests pass

## Examples

See `aes_encryption.go` main function for complete working examples.