Page cover

Software Design and Engineering

Software Design and Engineering

Software Design and EngineeringZencrypt is a Python-based cryptographic application originally developed in August 2022 as a command line interface (CLI) tool. The most recent enhancement was just added on the 21st of January 2025 in order to convert the CLI into a modern web app, while still maintaining the original CLI functionality from Zencrypt v4. This enhancement helps to showcase software engineering principles through implementing the CLI functionality using the Flask web framework and keeping the core cryptographic functionality separate.

Software Development and Enhancement:

The original CLI version provided encryption, hashing, and key management through a text-based interface:

def encrypt_text():
    text_to_encrypt = input("\nEnter the text to encrypt: ")
    encrypted_text = cipher_suite.encrypt(text_to_encrypt.encode()).decode()
    return encrypted_text

The enhanced version in v5 maintains this functionality while adding a web interface through Flask routes:

@app.route('/encrypt', methods=['GET', 'POST'])
def encrypt_page():
    if request.method == 'POST':
        text = request.form.get('text', '')
        if text:
            try:
                encrypted = cipher_suite.encrypt(text.encode())
                output = f"Encrypted Text:\n{encrypted.decode()}"
                return render_template_string(APP_TEMPLATE, 
                    content=content, output=output)

Justification for Enhancement - The enhancement helps to showcase several key software engineering principles:

  • Separation of Concerns:

Core cryptographic functions were moved to utils.py which allows both interfaces to share the same secure implementations of functions:from cryptography.fernet import Fernetdef initialize_key():if not os.path.exists(KEY_FILE):key = Fernet.generate_key()with open(KEY_FILE, "wb") as key_file:key_file.write(key)

  • Security Considerations:

The web implementation maintains the same level of security as the CLI v4 while adding new considerations for web-based threats. For example, for secure session handling:app.secret_key = secrets.token_hex(32)

Learning Outcomes and Challenges:

The enhancement process provided helpful learning opportunities for several key areas:

  • Web Security: Implementing secure web practices while maintaining cryptographic integrity

  • Interface Design: Creating a solid web UI/UX for complex cryptographic operations

  • Code Organization: Structuring the project in a scalable and modular format in order to properly maintain a clear separation between the CLI and webapps components.

The main challenge was adapting the already existing v4’s CLI based operations to a stateless web-app environment, all done without compromising any of the user’s anonymity and security. This development process required careful consideration of how to begin developing the server to later include security methods like temporary sessions and secure handling and maintenance of databases.

Future Improvements for the WebApp / Next enhancements:

  • Adding Login and add logging and temporary sessions

  • Implementing MongoDB or SQLite

  • Utilizing .config, .env, or even a .docker file to be used for constants

ePortfolio - www.ryanshatch.com

Web Application - www.zencrypt.app

Whitepapers - https://zencrypt.gitbook.io/zencrypt

Last updated