{"id":24408730,"url":"https://github.com/kunerd/jpaillier","last_synced_at":"2025-04-12T02:04:14.722Z","repository":{"id":13259031,"uuid":"15944171","full_name":"kunerd/jpaillier","owner":"kunerd","description":"A Java implementation of Paillier cryptosystem.","archived":false,"fork":false,"pushed_at":"2018-12-07T16:17:00.000Z","size":51,"stargazers_count":35,"open_issues_count":1,"forks_count":21,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T02:04:08.713Z","etag":null,"topics":["java","paillier-cryptosystem"],"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/kunerd.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":"2014-01-15T18:36:07.000Z","updated_at":"2024-07-17T07:49:46.000Z","dependencies_parsed_at":"2022-09-23T11:31:20.096Z","dependency_job_id":null,"html_url":"https://github.com/kunerd/jpaillier","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunerd%2Fjpaillier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunerd%2Fjpaillier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunerd%2Fjpaillier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kunerd%2Fjpaillier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kunerd","download_url":"https://codeload.github.com/kunerd/jpaillier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505863,"owners_count":21115354,"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":["java","paillier-cryptosystem"],"created_at":"2025-01-20T05:52:42.049Z","updated_at":"2025-04-12T02:04:14.691Z","avatar_url":"https://github.com/kunerd.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"jPaillier\n=========\n[![Build Status](https://travis-ci.org/kunerd/jpaillier.png?branch=master)](https://travis-ci.org/kunerd/jpaillier)\n\nA Java implementation of the Paillier cryptosystem.\n\nThis library was developed as part of the research project CoPPDA (Corporate Privacy Preserving Data Analysis, http://www.enterprise-application-development.org/projects/coppda.html). To see it in action have a look at [ppid3](https://github.com/kunerd/ppid3) where it is used to implement a privacy preserving ID3 decision tree generation algorithm.\n\n**WARNING: This library was developed for research only and is by no means implemented in a cryptographically secure way.**\n\nUsage\n-----\n\ncreate a key pair:\n```\n    KeyPairBuilder keygen = new KeyPairBuilder();\n    keyPair = keygen.generateKeyPair();\n```\nencryption:\n```\n\tPublicKey publicKey = keyPair.getPublicKey();\n    BigInteger ciphertext = publicKey.encrypt(plainData);\n```\n\ndecrypt a ciphertext:\n```\n    BigInteger decryptedData = keyPair.decrypt(ciphertext);\n```\n\nHomomorphic Addition\n--------------------\nAn interesting feature of the Paillier cryptosystem is its homomophic properties. The following example demonstrates how this library can be used to compute the homomorphic addition of two plaintext input values.\n```\n\tBigInteger plainA = BigInteger.valueOf(102);\n\tBigInteger plainB = BigInteger.valueOf(203);\n\n\tBigInteger encryptedA = publicKey.encrypt(plainA);\n\tBigInteger encryptedB = publicKey.encrypt(plainB);\n\t\n\tBigInteger encryptedProduct = encryptedA.multiply(encryptedB).mod(publicKey.getnSquared());\n\n\tBigInteger additionResult = keypair.decrypt(encryptedProduct);\n\t\t\n\t// additionResult = 102 + 203 = 305\n```\nSee the references for details. More examples can be found in the file: [HomomorphicPropertiesTest](https://github.com/kunerd/jpaillier/blob/master/src/test/java/de/henku/jpaillier/HomomorphicPropertiesTest.java).\n\n## References\n * [Public-Key Cryptosystems Based on Composite\nDegree Residuosity Classes](http://www.cs.tau.ac.il/~fiat/crypt07/papers/Pai99pai.pdf)\n * [Wikipedia article](https://en.wikipedia.org/wiki/Paillier_cryptosystem)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunerd%2Fjpaillier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkunerd%2Fjpaillier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkunerd%2Fjpaillier/lists"}