CNS-DGSW/ReflectiveCipher
A Reflection Cryption Library fork with additional features and fixes
ReflectiveCipher
ReflectiveCipher is a Reflection Encrypt Library forked base on
Reflcypt.
The main focus of this project is adding new features and patches
while also keeping up to date with the original project
library's default key-algorithm isPBKDF2WithHmacSHA256
How To Use
Simple implementation
In your security field, add the code below
public class Secret {
@SecurityField // encrypt and decrypt this field.
private String field;
@EncryptParams // encrypt 'topSecret' parameter
public void vulnerableMethod(@SecurityParam String topSecret) {
// ...
}
@DecryptReturns // decrypt and return 'NonSecret' object
public NonSecret info() {
// ...
}
}Properties
[for field] @SecurityField
Assign field to encrypt or decrypt
- support types:
- String
- byte[] or Byte[]
[for Param] @SecurityParam
Assign parameter to encrypt or decrypt
- support types:
- String
- byte[] or Byte[]
[for Method] @EncryptParams
Encrypt argument, encrypt all field in argument
- useful in JPA Repository.
- ex)
.save()- when entity save, will encrypt
- ex)
[for Method] @DecryptParams
Decrypt argument, decrypt all field in argument
[for Method] @EncryptReturns
Encrypt return object
[for Method] @DecryptReturns
Decrypt return object
- useful in JPA Repository
- when method call from JPA Repository, decrypt entity and return
Springboot Application properties
Springboot properties prefix is cipher
algorithm
Set cipher-algorithm such as 'AES/CBC/PKCS5Padding'
- Must be choose in Java Security Standard Algorithm Name
- The class is Cipher
key
Set secret-key
hash
Set hash value
iv
Set Initialization Vector value
- Length is must be 16 bytes long
Collaboration
It adheres to Java's standard conventions, it's flexible enough for many variations,
and I'm sure you can improve and add more features to the API in an easy-to-use way,
so feel free to post ideas, issues, and pull requests.
Licence
ReflectiveCipher is available under the MIT License.
π§βπ» Thanks to the original developer
- μ΄μΉλ―Ό (Eric Lee) - CNS 3κΈ° λ°±μλν