{"id":21376917,"url":"https://github.com/codesqueak/jackson-json-crypto","last_synced_at":"2025-07-13T10:31:17.584Z","repository":{"id":43642460,"uuid":"115656113","full_name":"codesqueak/jackson-json-crypto","owner":"codesqueak","description":"Jackson Crypto Extension Module","archived":false,"fork":false,"pushed_at":"2022-01-25T09:41:14.000Z","size":222,"stargazers_count":20,"open_issues_count":4,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-08-05T11:13:41.342Z","etag":null,"topics":["aes","encryption","jackson","java","json","module"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codesqueak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-28T20:11:48.000Z","updated_at":"2022-11-15T19:38:48.000Z","dependencies_parsed_at":"2022-09-17T22:20:57.989Z","dependency_job_id":null,"html_url":"https://github.com/codesqueak/jackson-json-crypto","commit_stats":null,"previous_names":[],"tags_count":3,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesqueak%2Fjackson-json-crypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesqueak%2Fjackson-json-crypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesqueak%2Fjackson-json-crypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codesqueak%2Fjackson-json-crypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codesqueak","download_url":"https://codeload.github.com/codesqueak/jackson-json-crypto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225871245,"owners_count":17537217,"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","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","encryption","jackson","java","json","module"],"created_at":"2024-11-22T09:18:11.441Z","updated_at":"2024-11-22T09:18:11.950Z","avatar_url":"https://github.com/codesqueak.png","language":"Java","funding_links":["https://www.buymeacoffee.com/codesqueak"],"categories":[],"sub_categories":[],"readme":"![CodeQL](https://github.com/codesqueak/jackson-json-crypto/workflows/CodeQL/badge.svg) \n![Java CI with Gradle](https://github.com/codesqueak/jackson-json-crypto/workflows/Java%20CI%20with%20Gradle/badge.svg)\n[![Maven Central](https://img.shields.io/maven-central/v/com.codingrodent/jackson-json-crypto.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.codingrodent%22%20AND%20a:%22jackson-json-crypto%22)\n\n# Jackson JSON Crypto Module\n\nA Jackson module to support JSON encryption and decryption operations. Encryption is via AES. Key generation is password\nbased.\n\nKeyword: Jackson, JSON, AES, PKCS5, Encryption, Salt, Initialization Vector, IV, Java\n\nBased on an idea from [meltmedia](https://github.com/meltmedia/jackson-crypto)\n\nIf you find this project useful, you may want to [__Buy me a Coffee!__ :coffee:](https://www.buymeacoffee.com/codesqueak) Thanks :thumbsup:\n\n## Build\n\nWindows\n\n```\ngradlew clean build test\n```\n\nLinux\n\n```\n./gradlew clean build test\n```\n## How to use\n\nThese examples are demonstrated in the ```CryptoDemo``` unit test class\n\n### Option 1 - Very Quick and Easy\n\nAdd the crypto module to your project. Common use case with a cipher of AES/CBC/PKCS5Padding and a key factory algorithm of PBKDF2WithHmacSHA512\n\nJust supply a password.\n\n```java\nObjectMapper objectMapper = EncryptionService.getInstance(\"Password1\");\n```\n\n\n### Option 2 - Quick and Easy\n\nSimilar to Option 1, but you already have a ObjectMapper \n\n```java\nObjectMapper objectMapper = ...\nEncryptionService encryptionService = \n   new EncryptionService(objectMapper, new PasswordCryptoContext(\"Password1\");\nobjectMapper.registerModule(new CryptoModule().addEncryptionService(encryptionService));\n```\n\n\n### Option 3 - Configure Everything\n\nWhere you just need full control. \n\n```java\n// get an object mapper\nObjectMapper objectMapper = new ObjectMapper();\n// set up a custom crypto context - Defines the interface to the crypto algorithms used\nICryptoContext cryptoContext = new PasswordCryptoContext(\"Password\");\n// The encryption service holds functionality to map clear to / from encrypted JSON\nEncryptionService encryptionService = new EncryptionService(objectMapper, cryptoContext);\n// Create a Jackson module and tell it about the encryption service\nCryptoModule cryptoModule = new CryptoModule().addEncryptionService(encryptionService);\n // Tell Jackson about the new module\nobjectMapper.registerModule(cryptoModule);\n```\n\n\n### Encrypt a field\n\nAny field that is required to be encrypted has to be marked as such.  This can be done by either annotating the getter() or \nby annotating the field definition.\n\nThis ...\n\n```java\n    private String critical;\n    ...\n    @JsonProperty\n    @Encrypt\n    public String getCritical() {\n        return this.critical;\n    }\n```\n\n... or ...\n\n```java\n    @JsonProperty\n    @Encrypt\n    private String critical;\n```\n\n## Output JSON Format\n```json\n{  \n   \"critical\":{  \n      \"salt\":\"IRqsz99no75sx9SCGrzOSEdoMVw=\",\n      \"iv\":\"bfKvxBhq7X5su9VtvDdOGQ==\",\n      \"value\":\"pXWsFPzCnmPieitbGfkvofeQE3fj0Kb4mSP7e28+Jc0=\"\n   }\n}\n```\n\n## Using Jenkins\n\nThe project includes a Jenkins file to control a pipeline build.\n\n## Include Using Maven\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.codingrodent\u003c/groupId\u003e\n  \u003cartifactId\u003ejackson-json-crypto\u003c/artifactId\u003e\n  \u003cversion\u003e2.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Include Using Gradle\n\n```\ncompile group: 'com.codingrodent', name: 'jackson-json-crypto', version: '2.2.0'\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesqueak%2Fjackson-json-crypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodesqueak%2Fjackson-json-crypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesqueak%2Fjackson-json-crypto/lists"}