{"id":20569646,"url":"https://github.com/virgula0/javaencryptionutility","last_synced_at":"2026-05-19T19:08:29.044Z","repository":{"id":168591114,"uuid":"347759479","full_name":"Virgula0/JavaEncryptionUtility","owner":"Virgula0","description":"A handy utility to quickly encrypt/decrypt strings from terminal and files using AES/RSA and avoiding the use of OpenSSL binaries.","archived":false,"fork":false,"pushed_at":"2021-03-17T20:19:32.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T09:46:44.168Z","etag":null,"topics":["aes","decrypt-strings","jar","java","rsa","utility"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Virgula0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-14T21:32:52.000Z","updated_at":"2021-04-24T09:09:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"1b2c6a9a-d8e5-46a1-a17f-0eccfbf07b22","html_url":"https://github.com/Virgula0/JavaEncryptionUtility","commit_stats":null,"previous_names":["virgula0/javaencryptionutility"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Virgula0/JavaEncryptionUtility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Virgula0%2FJavaEncryptionUtility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Virgula0%2FJavaEncryptionUtility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Virgula0%2FJavaEncryptionUtility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Virgula0%2FJavaEncryptionUtility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Virgula0","download_url":"https://codeload.github.com/Virgula0/JavaEncryptionUtility/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Virgula0%2FJavaEncryptionUtility/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266633294,"owners_count":23959526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes","decrypt-strings","jar","java","rsa","utility"],"created_at":"2024-11-16T05:09:05.581Z","updated_at":"2026-05-19T19:08:29.010Z","avatar_url":"https://github.com/Virgula0.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaEncryptionUtility\nA handy utility to quickly encrypt/decrypt strings from terminal and files using AES/RSA and avoiding the use of OpenSSL binaries.\n\n### Summary\n\n* [Arguments List](#arguments-list) \u003cbr\u003e\n* [Quick use](#quick-use) \u003cbr\u003e\n* [API](#use-in-your-projects)\n\n## Arguments List\n\n```\n                 ----------------------------------REQUIRED ARGUMENTS--------------------------\n                 \u003cencrypt/decrypt | encryptFile/decryptFile\u003e Choose if you want to encrypt or decrypt data                        \n                 -b\u003cAES | RSA\u003e Choose between RSA and AES encryption                                                               \n                 \\\"content to encrypt goes here\\\"                                                                                  \n                 --------------------------OPTIONAL ARGUMENTS FOR AES--------------------------\n                 -s \u003c128 | 192 | 256\u003e specify the size of the key with one of the shown value.                                \n                          Default is 128.                                                                                      \n                 -fiv \u003cFILELOCATION\u003e Import from a file the hexadecimal IV.                             \n                 -p \u003cPASS:SALT\u003e set a password for encryption/decryption with the specified PASS and SALT                 \n                 -k \u003cKEYFILELOCATION\u003e Import a Base64 encoded key from a file                           \n                 -a \u003cCBS|CFB|OFB|CTR|GCM\u003e Choose an algorithm type                                                              \n                          Default is CBS                                                                                       \n                 -wiv \u003cFILENAME\u003e Creates a file and writes the latest IV used (or specified)                  \n                 -wk \u003cFILENAME\u003e Creates a file with the latest Key Encoded value used (or specified)     \n                 -i \u003cFILENAME\u003e Input file encrypted/decrypted or physical file to encrypt/decrypt.                            \n                 -o \u003cFILENAME\u003e Output file to specify if you want to encrypt/decrypt an entire physical file or               \n                          where you want to save encrypted/decrypted content.                                            \n                 -v Set verbose to true (Use it only for encryptFile/decryptFile when files are big)                                                                         \n                          Default is set to false                                                                              \n                  ---------------------------------OPTIONAL ARGUMENTS FOR RSA--------------------------\n                  -s \u003c512|1024|2048|4096....|inf\u003e Set the key size, powers of 2!!                                      \n                          Default is set to 512                                                                               \n                   You may need to specify -s option when encrypting/decrypting physical files                         \n                  -fkpr \u003cFILENAME\u003e Import a private key with a PEM format from a file                                   \n                  -fkpu \u003cFILENAME\u003e Import a public key with a PEM format from a file                                    \n                  -wkpr \u003cFILENAME\u003e Creates a file with the latest private key used in PEM format                              \n                  -wkpu \u003cFILENAME\u003e Creates a file with the latest public key used in PEM format                               \n                  -i \u003cFILENAME\u003e Input file encrypted/decrypted                                                                \n                  -o \u003cFILENAME\u003e Output file to specify if you want to encrypt/decrypt an entire physical file or               \n                          where you want to save encrypted/decrypted content.                        \n                  -v Set verbose to true (Use it only for encryptFile/decryptFile when files are big)                                                                                                       \n                          Default is set to false                                                                             \n```\n## Quick Use\n\n#### Examples\n\n```\n1)Encrypt a string from terminal with AES. It will create files with iv and key respectively with names: iv.txt and key.txt\njava -jar JavaEncrytionUtility.jar encrypt -bAES -wiv iv.txt -wk key.txt -s 256 -a CBC \"ThisContentWillBeEncrypted\"\n\n2)Encrypt a string from terminal with RSA writing the generated key pair in private.txt and public.txt files.\njava -jar JavaEncrytionUtility.jar encrypt -bRSA -s 4096 -wkpr private.txt -wkpu public.txt \"ThisContentWillBeEncrypted\"\n\n3)Decrypt a string from terminal with AES using iv and key generated in the (1) step.\njava -jar JavaEncrytionUtility.jar decrypt -bAES -s 256 -a CBC -fiv iv.txt -k key.txt \"EncryptedStringFromStep1\"\n\n4)Decrypt a string from terminal with RSA reading the generated key pair from files generated from step (2). Supported format for private and public key is PEM, use your own if you have.\njava -jar JavaEncrytionUtility.jar decrypt -bRSA -s 4096 -fkpr private.txt -fkpu public.txt \"EncryptedContentFromTheStep2\"\n\n5)Encrypt the content of a file and saving it into an output file with AES.\njava -jar JavaEncrytionUtility.jar encrypt -bAES -wiv iv.txt -wk key.txt -s 256 -a CBC -i inputToEncrypt.txt -o outputEncrypted.txt\n\n6)Encrypt the content of a file and saving it into an output file with RSA.\njava -jar JavaEncrytionUtility.jar encrypt -bRSA -s 4096 -wkpr private.txt -wkpu public.txt -i inputToEncrypt.txt -o outputEncrypted.txt\n\n7)Decrypt the content of a file from terminal with AES using encrypted output file from the step (5)\njava -jar JavaEncrytionUtility.jar decrypt -bAES -fiv iv.txt -k key.txt -s 256 -a CBC -i outputEncrypted.txt -o decrypted.txt\n\n8)Decrypt the content of a file from terminal with RSA using encrypted output file from the step (6)\njava -jar JavaEncrytionUtility.jar decrypt -bRSA -s 4096 -fkpr private.txt -fkpu public.txt -i outputEncrypted.txt -o decrypted.txt\n\n9)Encrypt a file with AES (The difference with the example 5 is that this method is specifically coded also for huge files)\njava -jar JavaEncrytionUtility.jar encryptFile -bAES -wiv iv.txt -wk key.txt -s 256 -a CBC -i fileToEncrypt.txt -o saveEncrypted.txt\n\n10)Encrypt a file with RSA (The difference with the example 6 is that this method is specifically coded also for huge files)\nWARNING: RSA is not made for encrypt/decrypt huge files. It is extremely slow. Use it only for educational purpose or with files which their size is few kbs.\njava -jar JavaEncrytionUtility.jar encryptFile -bRSA -s 4096 -wkpr private.txt -wkpu public.txt -i inputToEncrypt.txt -o outputEncrypted.txt\n\n11)Decrypt a file with AES \njava -jar JavaEncrytionUtility.jar decryptFile -bAES -fiv iv.txt -k key.txt -s 256 -a CBC -i saveEncrypted.txt -o decrypted.txt\n\n10)Decrypt a file with RSA \nWARNING: RSA is not made for encrypt/decrypt huge files. It is extremely slow. Use it only for educational purpose or with files which their size is few kbs.\njava -jar JavaEncrytionUtility.jar decryptFile -bRSA -s 4096 -fkpr private.txt -fkpu public.txt -i outputEncrypted.txt -o decrypted.txt\n\n```\n\n## Use in your projects\n\n### Import\nImport the jar in your project. How to do it depends on what IDE you're using.\n\n### AES\n\n```java\n        OperatingSystemAbstract o = new Windows(new Linux(new MacOSX(null))); \n        OperatingSystemAbstract op = o.matches(null);   //Detect Operating System\n\n        List\u003cLogger\u003e loggers = new ArrayList\u003c\u003e();\n        loggers.add(new ConsoleLogger(op));\n        SimmetricEncryption enc = new AESEncryption(loggers);\n\n        //Set a custom size\n        enc.setSize(256);\n\n        //Write Iv and Key in a File\n        enc.writeIv(new File(\"iv.txt\"));\n        enc.writeKey(new File(\"key.txt\"));\n\n        //Get the generated Key and Iv\n        String generatedKey = enc.getKey();\n        String generatedIv = enc.getIV();\n\n        enc.setKey(generatedKey);\n        enc.setIv(generatedIv);\n        String encrypted = enc.encryptMessage(\"encrypt Me\");\n        System.out.println(\"Encrypted: \"+encrypted + \"\\nDecrypted: \" + enc.decryptMessage(encrypted));\n        loggers.forEach(x -\u003e System.out.print(x.getLogs())); //Print logs infos\n```\n\n### RSA\n\n```java\n        OperatingSystemAbstract o = new Windows(new Linux(new MacOSX(null))); \n        OperatingSystemAbstract op = o.matches(null);   //Detect Operating System\n\n        List\u003cLogger\u003e loggers = new ArrayList\u003c\u003e();\n        loggers.add(new ConsoleLogger(op));\n        AsyncEncryption enc = new RSAEncryption(loggers);\n\n        //set a custom key size\n        enc.setKeySize(4096);\n\n        //write key pair in files\n        enc.writePublicKeyToFile(new File(\"public.txt\"));\n        enc.writePrivateKeyToFile(new File(\"private.txt\"));\n\n        String encrypted = enc.encryptMessage(\"encrypt Me\");\n        System.out.println(\"Encrypted: \"+encrypted + \"\\nDecrypted: \" + enc.decryptMessage(encrypted));\n        loggers.forEach(x -\u003e System.out.print(x.getLogs())); //Print logs infos\n\n```\n\nFor the remaining methods and infos check generated [JavaDoc](https://github.com/Virgula0/JavaEncryptionUtility/releases/download/1.0.0.0/JavaDoc.zip). \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgula0%2Fjavaencryptionutility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirgula0%2Fjavaencryptionutility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgula0%2Fjavaencryptionutility/lists"}