Skip to content

A ready-to-use .NET cryptography library (SecureCrypto.dll) with a Python wrapper (securecrypto.py) for easy encryption, decryption, hashing, signing, and key management in your own applications.

License

Notifications You must be signed in to change notification settings

nitestryker/SecureCrypto-PythonBridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

SecureCrypto-PythonBridge

PyPI Python Versions License CI - Python self-test

πŸ” Production-ready cryptographic toolkit that just works
Seamlessly bridge .NET cryptography power with Python simplicity


⚑ Why SecureCrypto?

Building secure applications shouldn't require a PhD in cryptography. SecureCrypto delivers enterprise-grade encryption, signing, and key management through a clean Python API that wraps a battle-tested .NET cryptography library.

import securecrypto_bridge as sc

# It's this simple
encrypted = sc.encrypt("Secret data", "your-password")
decrypted = sc.decrypt(encrypted, "your-password")

✨ What's Inside

πŸ”’ Encryption Arsenal

  • AES symmetric encryption with PBKDF2 key derivation
  • RSA hybrid encryption for secure key exchange
  • File encryption with .enc format (salt + IV included)

πŸ”‘ Digital Security

  • RSA digital signatures for authenticity
  • HMAC generation & verification
  • SHA256/SHA512 hashing algorithms

πŸ› οΈ Developer Experience

  • Clean Pythonic API design
  • Comprehensive CLI tools
  • Ready-to-use examples
  • Zero-config setup

πŸ“ File Operations

  • Encrypt/decrypt files of any size
  • Digital signature workflows (.sig files)
  • Batch processing capabilities

⚠️ Platform Support: Currently Windows-only (leverages .NET Framework via pythonnet). Cross-platform support is on our roadmap.

πŸš€ Quick Setup

# Install from PyPI
pip install securecrypto-bridge

# Or install from source for development
pip install -e .

That's it! The library automatically handles .NET DLL loading and initialization.

πŸ’‘ Get Started in 30 Seconds

import securecrypto as sc

# Initialize the library
sc.init()

# πŸ” Password-based encryption
secret_data = "My confidential information"
encrypted = sc.encrypt(secret_data, "strong-password-123")
decrypted = sc.decrypt(encrypted, "strong-password-123")

# πŸ” Cryptographic hashing
file_hash = sc.hash_string("important-data", sc.ALGORITHMS[0])

# πŸ”‘ Public-key cryptography
public_key, private_key = sc.generate_keypair()
ciphertext = sc.hybrid_encrypt("Top secret message", public_key)
plaintext = sc.hybrid_decrypt(ciphertext, private_key)

# ✍️ Digital signatures
signature = sc.sign_string("document-content", private_key)
is_valid = sc.verify_string("document-content", signature, public_key)
print(f"Signature valid: {is_valid}")

πŸ–₯️ Command Line Power Tools

πŸ”“ Click to expand CLI examples

File Encryption & Decryption

# Encrypt a file
python -m securecrypto encrypt -p "mypassword" -i document.pdf -o document.enc

# Decrypt it back
python -m securecrypto decrypt -p "mypassword" -i document.enc -o document-restored.pdf

Digital Signatures

# Sign a document
python -m securecrypto sign -k private.pem -i contract.pdf -o contract.sig

# Verify the signature
python -m securecrypto verify -k public.pem -i contract.pdf -s contract.sig

Hashing & HMAC

# Generate file hash
python -m securecrypto hash -i largefile.zip -a sha256

# Create HMAC with shared secret
python -m securecrypto hmac -p "shared-secret" -i data.json -a sha512

Get Help Anytime

python -m securecrypto --help

CLI Reference:

Command Purpose Key Flags
encrypt Password-based file encryption -p (password), -i (input), -o (output)
decrypt Decrypt encrypted files -p (password), -i (input), -o (output)
sign Create digital signatures -k (private key), -i (file), -o (signature)
verify Verify signatures -k (public key), -i (file), -s (signature)
hash Generate file hashes -i (input), -a (algorithm)
hmac Generate HMAC -p (password), -i (input), -a (algorithm)

πŸ“š Learn More

πŸ—οΈ Architecture

C# Core Engine

The heart of SecureCrypto is a robust .NET class library that implements industry-standard cryptographic algorithms with proper security practices.

Build Requirements:

  • .NET Framework 4.8 (Windows)
  • Visual Studio 2022 or compatible IDE
  • Python bridge requires pythonnet

Project Structure:

SecureCrypto/
β”œβ”€β”€ SecureCrypto.sln          # Visual Studio solution
β”œβ”€β”€ SecureCrypto/
β”‚   β”œβ”€β”€ SecureCrypto.csproj   # C# project configuration  
β”‚   └── CryptoLib.cs          # Core cryptographic implementation

Building from Source:

  1. Open SecureCrypto.sln in Visual Studio
  2. Build in Release mode
  3. The compiled DLL will be ready for Python integration

🎯 Example Playground

Explore real-world scenarios with our example collection in the examples/ directory:

# Try them out
python examples/aes_example.py
python examples/rsa_hybrid_example.py  
python examples/sign_verify_example.py

πŸ›‘οΈ Security Best Practices

  • πŸ” Private Key Management: Store private keys securely. Never commit them to version control
  • πŸ’ͺ Strong Passwords: Use complex passwords for AES key derivation (12+ characters recommended)
  • πŸ” Modern Algorithms: Prefer SHA256/SHA512 over legacy hash functions
  • 🀝 Authentication Methods:
    • Use HMAC for shared-secret scenarios
    • Use RSA signatures for public/private key workflows
  • πŸ”„ Regular Updates: Keep the library updated for the latest security patches

πŸ“„ License

This project is released under the MIT License. You're free to use it in your applications, but please ensure compliance with your local security regulations and industry standards.


Built with ❀️ for developers who value security and simplicity

Report Issues β€’ Contribute β€’ Documentation

About

A ready-to-use .NET cryptography library (SecureCrypto.dll) with a Python wrapper (securecrypto.py) for easy encryption, decryption, hashing, signing, and key management in your own applications.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •