{"id":20637617,"url":"https://github.com/go-compile/rome","last_synced_at":"2025-04-15T21:51:26.299Z","repository":{"id":57706338,"uuid":"500601555","full_name":"go-compile/rome","owner":"go-compile","description":"The Elliptic and Edward Curve cryptography library built for multi-curve use. Unified crypto interface for ECDSA, EdDSA, ECIES and ECDH. NIST Curves, Brainpool, Ed25519, Ed448.","archived":false,"fork":false,"pushed_at":"2024-01-17T16:16:08.000Z","size":232,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T01:51:43.010Z","etag":null,"topics":["crypto","cryptography","ecdh","ecdsa","ecies","ed25519","edwards-curve","elliptic-curves","encrypt","multi-curve","p521"],"latest_commit_sha":null,"homepage":"","language":"Go","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/go-compile.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}},"created_at":"2022-06-06T21:40:29.000Z","updated_at":"2022-12-20T16:44:51.000Z","dependencies_parsed_at":"2024-01-17T18:01:33.219Z","dependency_job_id":"25cb6071-2b28-4d6e-97ac-61c0e53a17bf","html_url":"https://github.com/go-compile/rome","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/go-compile%2Frome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-compile%2Frome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-compile%2Frome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-compile%2Frome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-compile","download_url":"https://codeload.github.com/go-compile/rome/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249161104,"owners_count":21222468,"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":["crypto","cryptography","ecdh","ecdsa","ecies","ed25519","edwards-curve","elliptic-curves","encrypt","multi-curve","p521"],"created_at":"2024-11-16T15:15:18.210Z","updated_at":"2025-04-15T21:51:26.282Z","avatar_url":"https://github.com/go-compile.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rome\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/go-compile/rome.svg)](https://pkg.go.dev/github.com/go-compile/rome)\n[![Go Report Card](https://goreportcard.com/badge/go-compile/rome)](https://goreportcard.com/report/go-compile/rome)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/go-compile/rome/.github/workflows/go.yml)\n\nThe Elliptic and Edward Curve cryptography library built for multi-curve use. Unified crypto interface for ECDSA, EdDSA, ECIES and ECDH. A high level library which gives you the control: specify curve, KDFs or hash functions, ciphers etc. In addition, rome features RSA.\n\nGo Version: `\u003e= 18.0`\n\nTest Coverage: `80.0%`\n\n\u003cdiv align=center\u003e\n\n## Implemented Curves/Keys \u0026 Features\n\n| Curve/Key         |      Type      | Sign | Verify | Encrypt | DH  |\n| :---------------- | :------------: | :--: | :----: | :-----: | :-: |\n| Nist P-521        | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Nist P-384        | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Nist P-256        | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Nist P-224        | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P160r1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P160t1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P192r1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P192t1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P224r1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P224t1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P256r1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P256t1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P320r1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P320t1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P384r1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P384t1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P512r1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Brainpool P512t1  | Elliptic Curve |  ✔   |   ✔    |    ✔    |  ✔  |\n| Ed25519           | Edwards Curve  |  ✔   |   ✔    |   n/a   | n/a |\n| Ed448             | Edwards Curve  |  ✔   |   ✔    |   n/a   | n/a |\n| x25519/Curve25519 | Elliptic Curve |  ✖   |   ✖    |    ✖    |  ✖  |\n| x448 Goldilocks   | Elliptic Curve |  ✖   |   ✖    |    ✖    |  ✖  |\n| RSA               | RSA            |  ✔   |   ✔    |    ✔    |  ✖  |\n\n\u003c/div\u003e\n\n## Features\n\n- Generate key\n- Export (Public, Private) PEM **and** ASN.1 DER bytes\n- Import (Public, Private) PEM **and** ASN.1 DER bytes\n- Sign (ASN.1 format)\n- Verify\n- Elliptic Curve Diffie Hellman (ECDH)\n- Encrypt (ECIES: AES_GCM 128 \u0026 256 bit)\n- Decrypt\n- Retrieve Points\n- Convert Public Keys to SSH keys\n\n## Ciphers\n\n\u003cdiv align=\"center\"\u003e\n\n|      Cipher       | Authenticated |\n| :---------------: | :-----------: |\n|      AES_GCM      |       ✔       |\n|     ChaCha20      |       ✖       |\n|  ChaCha20_SHA256  |       ✔       |\n|  ChaCha20_SHA512  |       ✔       |\n| ChaCha20_Poly1305 |       ✔       |\n|      Salsa20      |       ✖       |\n\n\u003c/div\u003e\n\n## Curves \u0026 Keys\n\n- nist P-521\n- nist P-384\n- nist P-256\n- nist P-224\n- Ed25519\n- Ed448\n- Brainpool P160t1\n- Brainpool P192r1\n- Brainpool P192t1\n- Brainpool P224r1\n- Brainpool P224t1\n- Brainpool P256r1\n- Brainpool P256t1\n- Brainpool P320r1\n- Brainpool P320t1\n- Brainpool P384r1\n- Brainpool P384t1\n- Brainpool P512r1\n- Brainpool P512t1\n- RSA\n\n## Todo\n\n- secp256k1\n- saltpack\n- Encrypt private key option\n\n## Encrypt (ECIES)\n\nRome supports ECIES for elliptic curves allowing you to encrypt to a public key. Encryption can be customised with cipher options: `AES_256_GCM` (more coming soon) and customise KDFs used for shared secret generation (ECDH). Supporting the hash.Hash interface you can use your favourite algorithm. It's even possible to use Argon2 as a KDF.\n\nEncrypt example with `AES_256_GCM_SHA256`:\n\n```go\npackage main\n\nimport (\n\t\"crypto/sha256\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/go-compile/rome\"\n\t\"github.com/go-compile/rome/p256\"\n)\n\nfunc main() {\n\t// Generate a nist P256 Elliptic Curve\n\tk, err := p256.Generate()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpub := k.Public()\n\n\tmsg := []byte(\"Secret message.\")\n\n\t// encrypt message using AES256_GCM with SHA256 and a 98bit nonce\n\tciphertext, err := pub.Encrypt(msg, rome.CipherAES_GCM, sha256.New())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n    fmt.Printf(\"%X\\n\", ciphertext)\n}\n```\n\n## Install\n\n```sh\ngo get -u github.com/go-compile/rome\n```\n\n## Examples\n\nFull code [examples can be found ./examples/](./examples/)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/go-compile/rome\"\n\t\"github.com/go-compile/rome/p256\"\n)\n\nfunc main() {\n\t// Generate a nist P256 Elliptic Curve\n\tk, err := p256.Generate()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tprintKey(\"P256\", k)\n}\n\nfunc printKey(name string, k rome.PrivateKey) {\n\t// Format private key using PEM and ASN.1 DER bytes\n\tprivate, err := k.Private()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tpublic, err := k.Public().Key()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"%s:\\n Private:\\n%s\\n Public:\\n%s\\n\",\n\t\tname, string(private), string(public))\n}\n```\n\nOutput:\n\n```\nP256:\nPrivate:\n-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIATPRwGmsr81mgiH1Tf+yntyUcj0m9Ta3UsaWrgPjZtKoAoGCCqGSM49\nAwEHoUQDQgAENjGsmnjl4dXbRur5AfzlDxq6Bp0BQafwM7DJdhSv1yUNRF3+oDsw\nmZ9MD9z6VjjBh8REN6e0SDIM/IJCZL84DA==\n-----END EC PRIVATE KEY-----\n\nPublic:\n-----BEGIN EC PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAENjGsmnjl4dXbRur5AfzlDxq6Bp0B\nQafwM7DJdhSv1yUNRF3+oDswmZ9MD9z6VjjBh8REN6e0SDIM/IJCZL84DA==\n-----END EC PUBLIC KEY-----\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-compile%2Frome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-compile%2Frome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-compile%2Frome/lists"}