{"id":26879636,"url":"https://github.com/pineberrycode/quarkus-api-rsa","last_synced_at":"2026-04-12T16:09:44.378Z","repository":{"id":191513023,"uuid":"684812658","full_name":"PineberryCode/quarkus-api-rsa","owner":"PineberryCode","description":"💫 Quarkus API RSA 🔐✨","archived":false,"fork":false,"pushed_at":"2023-10-26T00:41:37.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-06-06T09:06:54.922Z","etag":null,"topics":["api","java","quarkus","rsa"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PineberryCode.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-08-29T22:55:04.000Z","updated_at":"2023-08-30T00:04:00.000Z","dependencies_parsed_at":"2023-08-30T08:13:06.795Z","dependency_job_id":"ff32745a-d3f6-4930-b434-3ba57f3a4921","html_url":"https://github.com/PineberryCode/quarkus-api-rsa","commit_stats":null,"previous_names":["pineberrycode/quarkus-api-rsa"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PineberryCode/quarkus-api-rsa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PineberryCode%2Fquarkus-api-rsa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PineberryCode%2Fquarkus-api-rsa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PineberryCode%2Fquarkus-api-rsa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PineberryCode%2Fquarkus-api-rsa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PineberryCode","download_url":"https://codeload.github.com/PineberryCode/quarkus-api-rsa/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PineberryCode%2Fquarkus-api-rsa/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268351171,"owners_count":24236358,"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-08-02T02:00:12.353Z","response_time":74,"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":["api","java","quarkus","rsa"],"created_at":"2025-03-31T13:31:09.061Z","updated_at":"2026-04-12T16:09:44.347Z","avatar_url":"https://github.com/PineberryCode.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quarkus-api-rsa\n\nInitialize the API with this in your terminal:\n\u003e Linux\n```\n./mvnw quarkus:dev\n```\n\u003e Windows\n```\n.\\mvnw.cmd quarkus:dev\n```\nIf you want to set the port of the _quarkus-api-rsa_ application you can adjust it in the **application.properties** file:\n```\nquarkus.http.port= PORT\n```\n\n- - -\n\nFor using this API specifically the use of **keys (Private/Public)**\u003cbr\u003e\u003cbr\u003e\nFirst, you have to make two *get requests* to the API, one of them for the **private key** and the other for the **public key**:\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ch6\u003eGetting class\u003c/h6\u003e\u003c/summary\u003e\n  \n```JAVA\npublic class Getting {\n\n  private final static String urlString = \"http://localhost:8081/api/v1\";\n\n  public static String PRIVATE_KEY () {\n        String priv = urlString.concat(\"/priv\");\n        StringBuffer strBuffer = null;\n        try {\n            URL url = new URL(priv);\n            HttpURLConnection connection = (HttpURLConnection) url.openConnection();\n            connection.setRequestMethod(\"GET\");\n\n            int response = connection.getResponseCode();\n\n            if (response == HttpURLConnection.HTTP_OK) {\n                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n                String inputLine;\n                strBuffer = new StringBuffer();\n\n                while ((inputLine = in.readLine()) != null) {\n                    strBuffer.append(inputLine);\n                }\n                in.close();\n            } else {\n                System.out.println(\"GET request failed. Response Code: \" + response);\n            }\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n        \n        return strBuffer.toString();\n    }\n\n  public static String PUBLIC_KEY () {\n        final String pub = urlString.concat(\"/pub\");\n        StringBuffer strBuffer = null;\n        try {\n            URL url = new URL(pub);\n            HttpURLConnection connection = (HttpURLConnection) url.openConnection();\n            connection.setRequestMethod(\"GET\");\n\n            int response = connection.getResponseCode();\n\n            if (response == HttpURLConnection.HTTP_OK) {\n                BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n                String inputLine;\n                strBuffer = new StringBuffer();\n\n                while ((inputLine = in.readLine()) != null) {\n                    strBuffer.append(inputLine);\n                }\n                in.close();\n            }\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n        return strBuffer.toString();\n    }\n}\n```\n\u003c/details\u003e\n\n- - -\n\nSubsequently, You can utilize the **private key** and **public key**, storing them in a variable into a new class:\n```JAVA\nprivate String priv = Getting.PRIVATE_KEY();\nprivate String pub = Getting.PUBLIC_KEY();\n```\nRemember to utilize these variable types **(PublicKey/PrivateKey)** in your class:\n```JAVA\nprivate PublicKey KEY_PUBLIC;\nprivate PrivateKey KEY_PRIVATE;\n```\nNow, to encrypt some input:\n```JAVA\npublic String Encrypt (String str) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {\n        byte[] bytesEncrypted;\n\n        Cipher cipher = Cipher.getInstance(\"RSA\");\n        cipher.init(Cipher.ENCRYPT_MODE, this.KEY_PUBLIC);\n        bytesEncrypted = cipher.doFinal(str.getBytes());\n        \n        return bytesToString(bytesEncrypted);\n}\n\n//Convert bytes to string:\nprivate String bytesToString(byte[] byt) {\n  byte[] secondByt = new byte[byt.length+1];\n  secondByt[0] = 1;\n  System.arraycopy(byt, 0, secondByt, 1, byt.length);\n  return new BigInteger(secondByt).toString(36);\n}\n```\nDecrypt some input:\n```JAVA\npublic String Decrypt (String str) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {\n  byte[] bytesDecrypted;\n\n  Cipher cipher = Cipher.getInstance(\"RSA\");\n\n  cipher.init(Cipher.DECRYPT_MODE, this.KEY_PRIVATE);\n  bytesDecrypted = cipher.doFinal(stringToBytes(str));\n\n  return new String (bytesDecrypted);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpineberrycode%2Fquarkus-api-rsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpineberrycode%2Fquarkus-api-rsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpineberrycode%2Fquarkus-api-rsa/lists"}