{"id":26802239,"url":"https://github.com/onqlavelabs/onqlave-java","last_synced_at":"2025-03-29T21:16:51.008Z","repository":{"id":185194844,"uuid":"657515762","full_name":"onqlavelabs/onqlave-java","owner":"onqlavelabs","description":"Onqlave SDK for the Java programming language.","archived":false,"fork":false,"pushed_at":"2023-08-30T02:37:21.000Z","size":186,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2023-08-30T10:38:21.170Z","etag":null,"topics":["encryption-tool","java","sdk-java"],"latest_commit_sha":null,"homepage":"https://docs.onqlave.com/guides/sdks/sdk-java/","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/onqlavelabs.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,"governance":null}},"created_at":"2023-06-23T08:26:50.000Z","updated_at":"2023-08-30T10:38:21.171Z","dependencies_parsed_at":"2023-08-01T03:31:51.737Z","dependency_job_id":null,"html_url":"https://github.com/onqlavelabs/onqlave-java","commit_stats":null,"previous_names":["onqlavelabs/onqlave-java"],"tags_count":10,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onqlavelabs","download_url":"https://codeload.github.com/onqlavelabs/onqlave-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246243546,"owners_count":20746312,"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":["encryption-tool","java","sdk-java"],"created_at":"2025-03-29T21:16:50.323Z","updated_at":"2025-03-29T21:16:50.994Z","avatar_url":"https://github.com/onqlavelabs.png","language":"Java","readme":"# onqlave-java\n\n# Description\nThis Java SDK is designed to help developers easily integrate Onqlave `Encryption As A Service` into their Java backend.\n\n[![CI](https://img.shields.io/static/v1?label=CI\u0026message=passing\u0026color=green?style=plastic\u0026logo=github)](https://github.com/onqlavelabs/onqlave-java/actions)\n# Table of Contents\n- [Description](#description)\n- [Table of Contents](#table-of-contents)\n    - [Features](#features)\n    - [Installation](#installation)\n        - [Requirements](#requirements)\n        - [Configuration](#configuration)\n        - [Usage](#usage)\n        - [Encrypt](#encrypt)\n        - [Decrypt](#decrypt)\n        - [Encrypt Stream](#encrypt-stream)\n        - [Decrypt Stream](#decrypt-stream)\n    - [Reporting a Vulnerability](#reporting-a-vulnerability)\n\n## Features\n\n- Encrypt/Decrypt piece of information\n- Encrypt/Decrypt stream of data\n\n## Installation\n\n### Requirements\n- OpenJDK 17 or higher\n- Maven \u003e= 3.x.x\n\n### Configuration\nMake sure your project is using Maven Modules (it will have a `pom.xml` file in its root if it already is):\n\n```java\nmvn install\n```\nThen, reference onqlave-java in a Java program with import:\n```java\nimport com.onqlave.encryption.Encryption;\n```\n\n### Usage\n\nTo use this SDK, you firstly need to obtain credential to access an Onqlave Arx by signing up to [Onqlave](https://onqlave.com) and following instruction to create your 1st Onqlave Arx. Documentation can be found at [Onqlave Technical Documentation](https://docs.onqlave.com).\n\nThe [Onqlave Java](https://github.com/onqlavelabs/onqlave-java) module is used to perform operations on the configured ARX such as encrypting, and decrypting for an Onqlave_ARX. [example](https://github.com/onqlavelabs/onqlave-java/src/main/java/com.onqlave/example):\n\nTo use this module, the Onqlave client must first be initialized as follows.\n\n```java\npackage com.example;\n\nimport com.onqlave.contract.Configuration;\nimport com.onqlave.contract.Credential;\nimport com.onqlave.contract.RetrySettings;\nimport com.onqlave.encryption.Encryption;\n\npublic class Main {\n    public static void main(String[] agrs) {\n        Credential credential = new Credential(\n                \"\u003capi_access_key\u003e\",           //This is the API Access Key returned of the API Key created during setup. Keep in a safe place.\n                \"\u003capi_signing_key\u003e\",          //This is the API Signing Key retruned of the API Key created during setup. Keep in a safe place.\n                \"\u003capi_secret_key\u003e\");          //This is the API Secret Key retruned of the API Key created during setup. Keep in a safe place.\n        RetrySettings retry = new RetrySettings(\n                \"\u003ccount\u003e\",                //Number of times to retry calling server endpoints in case of connection issue\n                \"\u003cwait_time\u003e\",            //How long to wait between each retry\n                \"\u003cmax_wait_time\u003e\");        //How long to wait in total for operation to finis\n        // Initial\n        Encryption encryption = new Encryption(credential, retry, \"\u003carx_url\u003e\", true);\n    }\n}\n```\nAll Onqlave APIs must be invoked using a `Encryption` instance.\n### Encrypt\nTo encrypt data, use the **Encrypt(byte[] planData, byte[] associatedData)** method of the Encryption service. The plainText parameter is the `byte[]` representation of data you are wishing to encrypt. The associatedData parameter the `byte[]` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\nEncryption call:\n```java\n    Encryption serivce = new Encryption(credential, retry, \"\u003carx_url\u003e\", true);\n    String plainText = \"This is a plain text string\";\n    String associatedData = \"this data needs to be authenticated, but not encrypted\";\n    byte[] cipherData = null;\n    try {\n        cipherData = serivce.Encrypt(plainText.getBytes(), associatedData.getBytes());\n    } catch (Exception e) {\n        //TODO: handle exception here.\n        System.out.println(e.getMessage());\n    }\n```\n### Decrypt\nTo decrypt data, use the **Decrypt(byte[] cipherText, byte[] associatedData)** method of the `Encryption` service. The **cipherData** parameter is the `byte[]` representation of data you are wishing to decrypt (previously encrypted). The **associatedData** parameter the `byte[]` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\nDecryption call:\n```java\n    Encryption serivce = new Encryption(credential, retry, \"\u003carx_url\u003e\", true);\n    String plainText = \"This is cipher data is already encrypted using `Encrypt` method\";\n    String associatedData = \"this data needs to be authenticated, but not encrypted\";\n    byte[] cipherData = null;\n    try {\n        cipherData = serivce.Decrypt(plainText.getBytes(),associatedData.getBytes());\n    } catch (Exception e) {\n        //TODO: handle exception here.\n        System.out.println(e.getMessage());\n    }\n```\n\n### Encrypt Stream\nTo encrypt stream of data, use the **EncryptStream(InputStream plainStream, OutputStream cipherStream, byte[] associatedData)** method of the `Encryption` service. The **plainStream** parameter is the `InputStream` stream of data you are wishing to encrypt. The **cipherStream** parameter is the `OutputStream` stream you are wishing to write the cipher data to. The **associatedData** parameter the `byte[]` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n```java\n    Encryption serivce = new Encryption(credential, retry, \"\u003carx_url\u003e\", true);\n    String plainText = \"This is cipher data is already encrypted using `Encrypt` method\";\n    String associatedData = \"this data needs to be authenticated, but not encrypted\";\n    InputStream encryptPlainStream = new ByteArrayInputStream(plainText.getBytes());\n    ByteArrayOutputStream encryptCipherStream = new ByteArrayOutputStream();\n    try {\n        service.EncryptStream(encryptPlainStream, encryptCipherStream, associatedData.getBytes());\n    } catch (Exception e) {\n        //TODO: handle exception here.\n        System.out.println(e.getMessage());\n    }\n```\n### Decrypt Stream\nTo decrypt stream of data, use the **DecryptStream(InputStream cipherStream,OutputStream plainStream, byte[] associatedData)** method of the `Encryption` service. The **cipherStream** parameter is the `InputStream` stream of data you are wishing to decrypt and it was originally encrypted using [EncryptStream](#encrypt-stream). The **plainStream** parameter is the `OutputStream` stream you are wishing to write the plain data back to. The **associatedData** parameter the `byte[]` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n```java\n    String plainText = \"This is cipher data is already encrypted using `Encrypt` method\";\n    Encryption serivce = new Encryption(credential, retry, \"\u003carx_url\u003e\", true);\n    ByteArrayInputStream dataEncrypted = new ByteArrayInputStream(encryptCipherStream.toByteArray());\n    ByteArrayOutputStream decryptPlainStream = new ByteArrayOutputStream();\n\n    try {\n        serivce.DecryptStream(dataEncrypted,decryptPlainStream, associatedData.getBytes());\n    } catch (Exception e) {\n        //TODO: handle exception here.\n        System.out.println(e.getMessage());\n    }\n```\n## Reporting a Vulnerability\nIf you discover a potential security issue in this project, please reach out to us at security@onqlave.com. Please do not create public GitHub issues or Pull Requests, as malicious actors could potentially view them.\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonqlavelabs%2Fonqlave-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonqlavelabs%2Fonqlave-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonqlavelabs%2Fonqlave-java/lists"}