Skip to content

Commit 4ec6ed9

Browse files
committed
feat: Implement batch encryption/decryption and update to v0.2.0
This release introduces batch encryption and decryption functionality, updates the project version to 0.2.0, and makes several improvements across the codebase. Key changes: - Implement batch encryption and decryption in Rust core (src/crypto/encryption.rs) - Add FFI bindings for batch operations (src/bindings/ffi.rs) - Update Go and Python examples to use new batch functions - Add tests for batch operations in all languages - Bump version to 0.2.0 in Cargo.toml - Update README with new project description and usage instructions Specific updates: 1. Rust: - Add decrypt_fields_in_batch and encrypt_fields_in_batch functions - Implement tests for new batch functions 2. Go: - Add decryptFieldsInBatch and encryptFieldsInBatch functions - Update main function to demonstrate batch operations - Add tests for batch operations 3. Python: - Add decrypt_fields_in_batch and encrypt_fields_in_batch functions - Update main function to demonstrate batch operations - Add tests for batch operations 4. Documentation: - Update README with new project description - Add usage instructions for batch operations 5. Project structure: - Remove unused go.rs and python.rs files - Update .gitignore This update significantly enhances the library's capabilities, allowing for more efficient processing of multiple records in a single operation.
1 parent f6b7374 commit 4ec6ed9

File tree

16 files changed

+545
-144
lines changed

16 files changed

+545
-144
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
target/
22
out/
3-
encryption_key_datasource_typescript_service_lib/
43
polycrypt_ffi_go
54
__pycache__/

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "polycrypt-rs"
3-
version = "0.1.6"
3+
version = "0.2.0"
44
edition = "2021"
55
authors = ["Ugochukwu Henry Onwuzurike henryowenzdev@gmail.com"]
66
description = "A multi-language cryptographic library wrapper"

README.md

Lines changed: 107 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,107 @@
1-
# polycrypt-rs
2-
3-
polycrypt-rs is a multi-language cryptographic library wrapper designed to provide a standardized encryption and decryption solution for organizations dealing with sensitive data, such as Protected Health Information (PHI) in healthcare settings.
4-
5-
## Motivation
6-
7-
In response to the challenges faced by a healthcare company client with a 100% PHI data layer field encryption requirement, polycrypt-rs was developed to:
8-
9-
1. Eliminate the need for a distributed de/encryption service, which could introduce latency and become a single point of failure.
10-
2. Avoid the complexity and maintenance overhead of implementing separate encryption libraries for each programming language used within the organization.
11-
3. Provide a unified, efficient, and secure cryptographic solution that can be easily integrated across various programming languages and platforms.
12-
13-
## Features
14-
15-
- AES encryption & decryption
16-
- Field-level encryption & decryption for JSON objects
17-
- FFI (Foreign Function Interface) bindings for Go and Python
18-
- Logging functionality
19-
20-
## Requirements
21-
22-
- Rust 1.55 or higher
23-
- Go 1.22 or higher (for Go bindings)
24-
- Python 3.6 or higher (for Python bindings)
25-
26-
## Installation
27-
28-
1. Clone the repository:
29-
```
30-
git clone https://github.com/HenryOwenz/polycrypt-rs.git
31-
cd polycrypt-rs
32-
```
33-
34-
2. Build the Rust library:
35-
```
36-
cargo build --release
37-
```
38-
39-
## Usage
40-
41-
### Using the Makefile
42-
43-
The project includes a Makefile that simplifies common tasks. Here are some useful commands:
44-
45-
- `make build`: Build the project in release mode
46-
- `make debug`: Build the project in debug mode
47-
- `make test`: Run Rust tests
48-
- `make go-test`: Run Go tests
49-
- `make py-test`: Run Python tests
50-
- `make test-all`: Run all tests (Rust, Go, and Python)
51-
- `make go-run`: Run the Go example
52-
- `make py-run`: Run the Python example
53-
- `make clean`: Clean the project
54-
- `make doc`: Generate documentation
55-
56-
To use these commands, simply run `make <command>` in the project root directory.
57-
58-
### Examples
59-
60-
The `examples` directory contains sample code for using polycrypt-rs with Go and Python:
61-
62-
- `examples/go_example.go`: Demonstrates usage of the library in Go
63-
- `examples/python_example.py`: Demonstrates usage of the library in Python
64-
65-
To run the examples:
66-
67-
1. For Go: `make go-run`
68-
2. For Python: `make py-run`
69-
70-
### Tests
71-
72-
The project includes tests for Rust, Go, and Python implementations:
73-
74-
- Rust tests: Located in `src` and `tests` directories
75-
- Go tests: Located in `examples/go_example_test.go`
76-
- Python tests: Located in `examples/python_example_test.py`
77-
78-
To run the tests:
79-
80-
1. For Rust: `make test`
81-
2. For Go: `make go-test`
82-
3. For Python: `make py-test`
83-
4. For all tests: `make test-all`
84-
85-
## License
86-
87-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
88-
89-
## Contributing
90-
91-
Contributions are welcome! Please feel free to submit a Pull Request.
92-
93-
1. Fork the repository
94-
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
95-
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
96-
4. Push to the branch (`git push origin feature/AmazingFeature`)
97-
5. Open a Pull Request
98-
99-
## Authors
100-
101-
- Ugochukwu Henry Onwuzurike - Initial work - [GitHub](https://github.com/HenryOwenz)
102-
103-
## Acknowledgments
104-
105-
- The Rust community for providing excellent cryptographic libraries
1+
# polycrypt-rs
2+
3+
polycrypt-rs is a multi-language cryptographic library wrapper designed to provide a standardized encryption and decryption solution for organizations dealing with sensitive data, such as Protected Health Information (PHI) in healthcare settings.
4+
5+
*A systems-level cryptographic library with cross-language FFI capabilities, designed for backend infrastructure and security-critical applications.*
6+
7+
## Motivation
8+
9+
In response to the challenges faced by a healthcare company client with a 100% PHI data layer field encryption requirement, polycrypt-rs was developed to:
10+
11+
1. Eliminate the need for a distributed de/encryption service, which could introduce latency and become a single point of failure.
12+
2. Avoid the complexity and maintenance overhead of implementing separate encryption libraries for each programming language used within the organization.
13+
3. Provide a unified, efficient, and secure cryptographic solution that can be easily integrated across various programming languages and platforms.
14+
15+
## Features
16+
17+
- AES encryption & decryption
18+
- Field-level encryption & decryption for JSON objects
19+
- FFI (Foreign Function Interface) bindings for Go and Python
20+
- Logging functionality
21+
22+
## Requirements
23+
24+
- Rust 1.55 or higher
25+
- Go 1.22 or higher (for Go bindings)
26+
- Python 3.6 or higher (for Python bindings)
27+
28+
## Installation
29+
30+
1. Clone the repository:
31+
```
32+
git clone https://github.com/HenryOwenz/polycrypt-rs.git
33+
cd polycrypt-rs
34+
```
35+
36+
2. Build the Rust library:
37+
```
38+
make
39+
```
40+
41+
## Usage
42+
43+
### Using the Makefile
44+
45+
The project includes a Makefile that simplifies common tasks. Here are some useful commands:
46+
47+
- `make build`: Build the project in release mode
48+
- `make debug`: Build the project in debug mode
49+
- `make test`: Run Rust tests
50+
- `make go-test`: Run Go tests
51+
- `make py-test`: Run Python tests
52+
- `make test-all`: Run all tests (Rust, Go, and Python)
53+
- `make go-run`: Run the Go example
54+
- `make py-run`: Run the Python example
55+
- `make clean`: Clean the project
56+
- `make doc`: Generate documentation
57+
58+
To use these commands, simply run `make <command>` in the project root directory.
59+
60+
### Examples
61+
62+
The `examples` directory contains sample code for using polycrypt-rs with Go and Python:
63+
64+
- `examples/go_example.go`: Demonstrates usage of the library in Go
65+
- `examples/python_example.py`: Demonstrates usage of the library in Python
66+
67+
To run the examples:
68+
69+
1. For Go: `make go-run`
70+
2. For Python: `make py-run`
71+
72+
### Tests
73+
74+
The project includes tests for Rust, Go, and Python implementations:
75+
76+
- Rust tests: Located in `src` and `tests` directories
77+
- Go tests: Located in `examples/go_example_test.go`
78+
- Python tests: Located in `examples/python_example_test.py`
79+
80+
To run the tests:
81+
82+
1. For Rust: `make test`
83+
2. For Go: `make go-test`
84+
3. For Python: `make py-test`
85+
4. For all tests: `make test-all`
86+
87+
## License
88+
89+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
90+
91+
## Contributing
92+
93+
Contributions are welcome! Please feel free to submit a Pull Request.
94+
95+
1. Fork the repository
96+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
97+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
98+
4. Push to the branch (`git push origin feature/AmazingFeature`)
99+
5. Open a Pull Request
100+
101+
## Authors
102+
103+
- Ugochukwu Henry Onwuzurike - Initial work - [GitHub](https://github.com/HenryOwenz)
104+
105+
## Acknowledgments
106+
107+
- The Rust community for providing excellent cryptographic libraries

docs/Overview.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# polycrypt-rs Overview
2+
3+
polycrypt-rs is a systems-level cryptographic library with cross-language FFI capabilities, designed for backend infrastructure and security-critical applications. It provides a standardized encryption and decryption solution for organizations dealing with sensitive data, such as Protected Health Information (PHI) in healthcare settings.
4+
5+
## Key Features and Design Decisions
6+
7+
1. **Unified Cryptographic Solution**: Implements a single core cryptographic library in Rust, eliminating the need for separate implementations in multiple languages.
8+
9+
2. **Cross-Language Compatibility**: Provides Foreign Function Interface (FFI) bindings for Go and Python, with the potential to easily add support for additional languages.
10+
11+
3. **Performance and Security**: Leverages Rust's performance and memory safety features for critical cryptographic operations.
12+
13+
4. **Field-Level Encryption**: Supports granular encryption of specific fields within JSON objects, allowing for flexible data protection strategies.
14+
15+
5. **Scalability**: Eliminates the need for a centralized encryption/decryption service, avoiding potential bottlenecks or single points of failure in distributed systems.
16+
17+
6. **Maintainability**: A single core implementation with FFI bindings is easier to maintain and update than separate implementations in multiple languages.
18+
19+
7. **Event-Driven Architecture Compatibility**: Well-suited for use in event-driven systems and data lakes.
20+
21+
8. **Extensibility**: The bindings folder and FFI approach make it straightforward to add support for additional languages in the future.
22+
23+
## Potential Use Cases
24+
25+
1. Healthcare and regulated industries dealing with sensitive data (PHI, PII, financial data)
26+
2. Organizations using multiple programming languages in their stack
27+
3. Microservices architectures requiring consistent encryption across services
28+
4. Event-driven systems and data lakes needing secure data handling
29+
30+
## Development and Testing Approach
31+
32+
1. **Core Implementation**: Developed in Rust for performance and safety
33+
2. **FFI Bindings**: Created for Go and Python, demonstrating cross-language capabilities
34+
3. **Example Code**: Provided for each supported language to showcase usage
35+
4. **Testing Strategy**:
36+
- Unit tests for individual functions in Rust
37+
- Integration tests for the Rust library
38+
- Language-specific tests for Go and Python bindings
39+
- Makefile commands for easy test execution across all languages
40+
41+
## Future Improvements
42+
43+
1. **Language-Specific Wrappers**: Create lightweight, idiomatic wrappers around the FFI layer for each supported language
44+
2. **Additional Cryptographic Features**: Consider adding support for digital signatures, key exchange protocols, etc.
45+
3. **Performance Benchmarks**: Provide comparisons against other encryption solutions
46+
4. **Continuous Integration**: Set up CI/CD pipelines for automated testing across all supported languages
47+
5. **Documentation**: Expand documentation with more examples and use cases
48+
49+
## Key Takeaways
50+
51+
1. A unified cryptographic solution can significantly reduce complexity in multi-language environments
52+
2. Rust provides an excellent foundation for building secure, performant cryptographic libraries
53+
3. FFI bindings offer a powerful way to extend core functionality to multiple languages
54+
4. Comprehensive testing across all supported languages is crucial for ensuring consistency and reliability
55+
56+
This approach to cryptographic library development offers a scalable, maintainable, and secure solution for organizations dealing with sensitive data across multiple programming languages and distributed systems.

examples/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
module go-ffi-test
22

33
go 1.22.0
4+
5+
require github.com/davecgh/go-spew v1.1.1

examples/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

0 commit comments

Comments
 (0)