2 releases
0.1.1 | Jan 6, 2025 |
---|---|
0.1.0 | Dec 18, 2024 |
#2305 in Cryptography
278 downloads per month
Used in jwt_app
14KB
226 lines
Authentication_app
Overview
This project implements a robust authentication system using both secret key authentication and RSA public-key cryptography. It is designed to provide secure communication between clients and servers, ensuring data integrity and confidentiality.
Features
- Secret Key Authentication: Utilizes symmetric encryption to authenticate users with a shared secret key, ensuring that only authorized users can access the system.
- RSA Authentication: Implements asymmetric encryption using RSA keys to securely exchange messages and verify identities without requiring a shared secret.
- Secure Data Transmission: Protects sensitive information during transmission using industry-standard cryptographic algorithms.
- Modular Design: The code is organized into modules for easy maintenance and extensibility.
Getting Started
RSA-Based JWTs
- Check Key Existence: Use the key_existance function to determine whether RSA public and private keys already exist.
- Read Existing Keys: If keys are found, the read_keys function will read and load them for use.
- Generate New Keys: If no keys exist, the generate_jwt function will create new RSA keys.
- Save Keys: After generatig or reading keys, you can save them using the save_keys function for future use.
- Verify Keys: To validate any public key, use the verify_jwt function.
Secret Key-Based JWTs
If you prefer to use a secret key instead of RSA, you can utilize the following:
- Generate JWT: Use the generate_jwt function under the jwt_secret module to create a JWT.
- Verify JWT: Use the verify_jwt function under the jwt_secret module to validate a secret-based JWT.
Installation
Add this crate to your Cargo.toml file:
[dependencies]
jwt_modes = "0.1.1"
Dependencies
~14MB
~353K SLoC