{"id":15188780,"url":"https://github.com/ekino/hibernate-crypto-types","last_synced_at":"2025-10-06T07:26:16.900Z","repository":{"id":39883384,"uuid":"224213814","full_name":"ekino/hibernate-crypto-types","owner":"ekino","description":"Provides new hibernate column types to encrypt your column data before being stored in your database","archived":false,"fork":false,"pushed_at":"2023-03-27T16:58:40.000Z","size":311,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-07-19T21:58:48.561Z","etag":null,"topics":["encryption","gradle","hibernate","jpa","secrets","security"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/ekino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2019-11-26T14:39:07.000Z","updated_at":"2023-02-14T09:20:16.000Z","dependencies_parsed_at":"2024-09-18T16:45:18.229Z","dependency_job_id":null,"html_url":"https://github.com/ekino/hibernate-crypto-types","commit_stats":{"total_commits":95,"total_committers":4,"mean_commits":23.75,"dds":0.5052631578947369,"last_synced_commit":"b1438272c8470eda2c249358267c10af58ec2487"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ekino/hibernate-crypto-types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fhibernate-crypto-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fhibernate-crypto-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fhibernate-crypto-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fhibernate-crypto-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekino","download_url":"https://codeload.github.com/ekino/hibernate-crypto-types/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekino%2Fhibernate-crypto-types/sbom","scorecard":{"id":370621,"data":{"date":"2025-08-11","repo":{"name":"github.com/ekino/hibernate-crypto-types","commit":"b1438272c8470eda2c249358267c10af58ec2487"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Code-Review","score":5,"reason":"Found 1/2 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/gradle-wrapper-validation.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/snapshot.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/gradle-wrapper-validation.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/gradle-wrapper-validation.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/gradle-wrapper-validation.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/gradle-wrapper-validation.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/snapshot.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/snapshot.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/snapshot.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/ekino/hibernate-crypto-types/snapshot.yml/master?enable=pin","Info:   0 out of  10 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Signed-Releases","score":8,"reason":"3 out of the last 3 releases have a total of 3 signed artifacts.","details":["Info: signed release artifact: hibernate-crypto-types-1.2.0-javadoc.jar.asc: https://github.com/ekino/hibernate-crypto-types/releases/tag/1.2.0","Info: signed release artifact: hibernate-crypto-types-1.1.0-javadoc.jar.asc: https://github.com/ekino/hibernate-crypto-types/releases/tag/1.1.0","Info: signed release artifact: hibernate-crypto-types-1.0.0-javadoc.jar.asc: https://github.com/ekino/hibernate-crypto-types/releases/tag/1.0.0","Warn: release artifact 1.2.0 does not have provenance: https://api.github.com/repos/ekino/hibernate-crypto-types/releases/29398314","Warn: release artifact 1.1.0 does not have provenance: https://api.github.com/repos/ekino/hibernate-crypto-types/releases/23337402","Warn: release artifact 1.0.0 does not have provenance: https://api.github.com/repos/ekino/hibernate-crypto-types/releases/21836786"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T12:50:31.464Z","repository_id":39883384,"created_at":"2025-08-18T12:50:31.464Z","updated_at":"2025-08-18T12:50:31.464Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278575570,"owners_count":26009391,"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-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["encryption","gradle","hibernate","jpa","secrets","security"],"created_at":"2024-09-27T19:42:14.478Z","updated_at":"2025-10-06T07:26:16.878Z","avatar_url":"https://github.com/ekino.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hibernate crypto types\n\n[![Build Status](https://github.com/ekino/hibernate-crypto-types/workflows/Build%20branch/badge.svg?branch=master)](https://github.com/ekino/hibernate-crypto-types/actions?query=workflow%3A%22Build+branch%22+branch%3Amaster)\n[![GitHub (pre-)release](https://img.shields.io/github/release/ekino/hibernate-crypto-types/all.svg)](https://github.com/ekino/hibernate-crypto-types/releases)\n[![Maven Central](https://img.shields.io/maven-central/v/com.ekino.oss.crypto/hibernate-crypto-types)](https://search.maven.org/search?q=a:hibernate-crypto-types)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ekino_hibernate-crypto-types\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=ekino_hibernate-crypto-types)\n\nLibrary adding custom encrypted hibernate types\n\n## Requirements\n\nJDK 11+\n\n## Installation\n\nFor example with Gradle Kotlin DSL :\n\n```kotlin\nimplementation(\"com.ekino.oss.crypto:hibernate-crypto-types:1.3.0-SNAPSHOT\")\n```\n\nNB : if you want to use snapshots you need to add the following configuration to your Gradle build script :\n\n```kotlin\nrepositories {\n  maven { url = uri(\"https://oss.sonatype.org/content/repositories/snapshots/\") }\n}\n```\n\n## Usage\n\nFollowing the example you can find in the `integrationTest` source set, you need:\n\n1. To define the secrets configuration to encrypt your data\n2. To define the new hibernate types\n3. Specify the column type to use for each field you want to encrypt\n\n### Secrets configuration\n\nCreate a bean to deserialize you configuration properties:\n```kotlin\n@ConstructorBinding\n@ConfigurationProperties(prefix = \"ekino.encrypt\")\ndata class EncryptProperties(val secret: String, val iv: String)\n```\n_See `com.ekino.oss.hibernate.config.EncryptProperties` in the `integrationTest` source set._\n\nAdd your secrets in your `application.yml` configuration:\n```yaml\nekino:\n  encrypt:\n    secret: \"my_very_long_secret_32_character\"\n    iv: \"initialization_V\"\n```\n_See `resources/application.yml` in the `integrationTest` source set._\n\nThen enable the configuration with the following configuration bean:\n```kotlin\n@Configuration\n@EnableConfigurationProperties(EncryptProperties::class)\nclass EncryptConfig(val encryptProperties: EncryptProperties) : CommandLineRunner {\n\n  override fun run(vararg args: String?) {\n    require(EncryptCredentialsHolder.SECRET == null)\n    require(EncryptCredentialsHolder.IV == null)\n    EncryptCredentialsHolder.SECRET = encryptProperties.secret\n    EncryptCredentialsHolder.IV = encryptProperties.iv\n  }\n}\n```\n_See `com.ekino.oss.hibernate.config.EncryptConfig` in the `integrationTest` source set._\n\n### Type definitions\n\nHere is a list of the new hibernate types provided by this library:\n\nType name|Target column type to encrypt|Comment\n---|---|---|\n`encrypted-text`|`String`|As the resulting encrypted text will still be the same for the same raw source, you may want to use `encrypted-text-with-salt` to change the result\n`encrypted-text-with-salt`|`String`|The resulting encrypted text will always be different for the same raw source\n`encrypted-json`|Any **non-primitive** `Object`|As the resulting encrypted text will still be the same for the same raw source, you may want to use `encrypted-json-salt-wrap` to change the result. **Warning**: if use with a `String` target type, the data won't be encrypted, please use `encrypted-text` or `encrypted-text-with-salt` instead\n`encrypted-json-salt-wrap`|Dedicated to `Enum` (or simple objects) but works for any **non-primitive** `Object`|The resulting encrypted text will always be different for the same raw source. **Warning**: if use with a `String` target type, the data won't be encrypted, please use `encrypted-text` or `encrypted-text-with-salt` instead\n\n\n#### Using an abstract entity\n\nYou can create a super abstract entity that will be extended by all your entities:\n````kotlin\n/**\n * Common superclass for all the entities.\n */\n@MappedSuperclass\n@TypeDefs(\n  TypeDef(name = \"encrypted-text\", typeClass = EncryptedStringType::class),\n  TypeDef(name = \"encrypted-text-with-salt\", typeClass = EncryptedStringWithSaltType::class),\n  TypeDef(name = \"encrypted-json\", typeClass = EncryptedJsonType::class),\n  TypeDef(name = \"encrypted-json-salt-wrap\", typeClass = EncryptedJsonSaltWrapType::class)\n)\nabstract class AbstractEntity(\n  // Put here some common field you may want to share for your sub-entities\n)\n````\n_See `com.ekino.oss.hibernate.model.AbstractEntity` in the `integrationTest` source set._\n\n### Specify your fields to encrypt\n\nExtends your previously defined abstract entity to apply your column type on demand:\n````kotlin\n@Entity\nclass Person(\n\n  var name: String,\n\n  @Type(type = \"encrypted-text\")\n  @Column(columnDefinition = \"encrypted-text\")\n  var password: String? = null,\n\n  @Type(type = \"encrypted-json\")\n  @Column(columnDefinition = \"encrypted-json\")\n  var privateData: PrivateData? = null,\n\n  @Type(type = \"encrypted-json-salt-wrap\")\n  @Column(columnDefinition = \"encrypted-json-salt-wrap\")\n  var someValue: SomeEnum? = null,\n\n  @Type(type = \"encrypted-text-with-salt\")\n  @Column(columnDefinition = \"encrypted-text-with-salt\")\n  var simpleValue: String? = null\n\n) : AbstractEntity()\n````\n_See `com.ekino.oss.hibernate.model.Person` in the `integrationTest` source set._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekino%2Fhibernate-crypto-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekino%2Fhibernate-crypto-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekino%2Fhibernate-crypto-types/lists"}