{"id":18375751,"url":"https://github.com/factomproject/java-identitykeys","last_synced_at":"2025-04-11T04:39:47.946Z","repository":{"id":79532941,"uuid":"204549131","full_name":"FactomProject/java-identitykeys","owner":"FactomProject","description":"Allows you to implement Factom identity keys in Java.","archived":false,"fork":false,"pushed_at":"2019-11-08T18:28:13.000Z","size":2451,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-11T04:39:41.964Z","etag":null,"topics":["blockchain-technology","cryptography","digital-identity","factom","factom-blockchain","public-key-cryptography"],"latest_commit_sha":null,"homepage":"https://www.factom.com/","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/FactomProject.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-26T19:44:24.000Z","updated_at":"2019-11-08T18:28:57.000Z","dependencies_parsed_at":"2023-05-01T10:31:50.312Z","dependency_job_id":null,"html_url":"https://github.com/FactomProject/java-identitykeys","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FactomProject%2Fjava-identitykeys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FactomProject%2Fjava-identitykeys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FactomProject%2Fjava-identitykeys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FactomProject%2Fjava-identitykeys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FactomProject","download_url":"https://codeload.github.com/FactomProject/java-identitykeys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345272,"owners_count":21088241,"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":["blockchain-technology","cryptography","digital-identity","factom","factom-blockchain","public-key-cryptography"],"created_at":"2024-11-06T00:20:11.474Z","updated_at":"2025-04-11T04:39:47.916Z","avatar_url":"https://github.com/FactomProject.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# java-identitykeys\nA small module of tools to generate and use key pairs for Factom Identities. These identities and keys are required when using the [Factom Signing Standard](https://docs.harmony.factom.com/docs/factom-signing-standard) to create authenticated blockchain entries.\n\n# Usage\nEach instance of java-identitykeys can have a single [Ed25519 key pair](https://ed25519.cr.yp.to/) loaded into memory. Once a key is loaded, you can use the included functions to display information about the key as well as to sign and verify transactions.\n\n## Creating a new Key\nTo create a new identity key, use the `setIdentityWithNewKey()` method. This will return a randomly generated `idsec` formated private key.\n\n```\nsetIdentityWithNewKey();\n```\n\n\n## Importing a Private key\nThere are two options you can use to import an existing private key:\n\n**From 32 byte private key**\n\nAn existing key or new byte array can be used to create an `idsec` formatted key.\n\n  ```setIdentityFromPrivateKeyBytes(seed);```\n \n\n**From an existing `idsec` key string**\n\nIf you have the idsec format key, you can import it using the following command.\n\n  ```setIdentityFromPrivateKeyString(\"idsecXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\");```\n\n\n## Signing and Verification\nOnce the identity has been set, 4 methods are available to help you sign and verify using those keys. These will return the data of the currently loaded key.\n\n**To get idsec formatted string of private key**\n\n  ```  getIDSecString();```\n  \n**To get idpub formatted string of public**\n\n  ```  getIDPubString();```\n   \n**To get private key bytes**\n\n  ```  getIDSecBytes ();```\n  \n**To get public key bytes**\n\n  ```\tgetIDPubBytes ();```\n  \n\n### Signing\nTo sign byte data using private key  (key already loaded from set call)**\n\n  ```   byte[] Signature = new byte[64];\n     Signature = signData( bytedata );\n   ```\n\n### Verification\nTo verify signature using public key   (key already loaded from set call)\n\n```\n      Boolean valid= verifyData( bytedata, Signature)\n```\n\nIf you need to load the public key for signature verification\n``` \n  setIdentityFromPublicKeyString( idpub key string);\n ```\n or\n ```\n      setIdentityFromPublicKeyBytes(public key bytes);\n   ```\n   then verify\n\n# Format of an Identity Key Pair\n*Note: the following text is taken from the [Application Identity Specification](https://github.com/FactomProject/FactomDocs/blob/FD-849_PublishNewIdentitySpec/ApplicationIdentity.md)*\n\nFor Factom Application Identities, ed25519 keys are used to sign and verify messages. Rather than simply using raw 32 byte arrays for keys, the following encoding scheme is used: \n\nPseudo-code for constructing a private key string:\n```\nprefix_bytes = [0x03, 0x45, 0xf3, 0xd0, 0xd6]              // gives an \"idsec\" prefix once in base58 \nkey_bytes = [32 bytes of raw private key]                  // the actual ed25519 private key seed\nchecksum = sha256( sha256(prefix_bytes + key_bytes) )[:4]  // 4 byte integrity check on the previous 37 bytes\n\nidsec_key_string = base58( prefix_bytes + key_bytes + checksum )\n```\n\nPseudo-code for constructing a public key string:\n```\nprefix_bytes = [0x03, 0x45, 0xef, 0x9d, 0xe0]              // gives an \"idpub\" prefix once in base58 \nkey_bytes = [32 bytes of raw public key]                   // the actual ed25519 public key\nchecksum = sha256( sha256(prefix_bytes + key_bytes) )[:4]  // 4 byte integrity check on the previous 37 bytes\n\nidpub_key_string = base58( prefix_bytes + key_bytes + checksum )\n```\n\nFor the sake of human-readability, all characters must be in Bitcoin's base58 character set, the private key will always begin with \"idsec\", and the public key will always begin with \"idpub\". Additionally, the checksum at the end serves to signal that a user has incorrectly typed/copied their key.\n\nExample key pair for the private key of all zeros:\n- `idsec19zBQP2RjHg8Cb8xH2XHzhsB1a6ZkB23cbS21NSyH9pDbzhnN6 idpub2Cy86teq57qaxHyqLA8jHwe5JqqCvL1HGH4cKRcwSTbymTTh5n`\n\nExample key pair for the private key of all ones:\n- `idsec1ARpkDoUCT9vdZuU3y2QafjAJtCsQYbE2d3JDER8Nm56CWk9ix idpub2op91ghJbRLrukBArtxeLJotFgXhc6E21syu3Ef8V7rCcRY5cc`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffactomproject%2Fjava-identitykeys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffactomproject%2Fjava-identitykeys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffactomproject%2Fjava-identitykeys/lists"}