{"id":15032331,"url":"https://github.com/atropinetears/selenite","last_synced_at":"2025-04-09T21:23:07.644Z","repository":{"id":57666566,"uuid":"221785137","full_name":"AtropineTears/Selenite","owner":"AtropineTears","description":"An Experimental Rust Crate for Post-Quantum Code-Signing Certificates.","archived":false,"fork":false,"pushed_at":"2021-12-11T23:36:20.000Z","size":225,"stargazers_count":24,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T23:15:49.457Z","etag":null,"topics":["certificate","crate","crypto","cryptography","digital-signature","falcon","library","post-quantum","post-quantum-cryptography","pqcrypto","rust","rust-lang","sphincs"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AtropineTears.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":"2019-11-14T20:54:29.000Z","updated_at":"2025-03-15T10:26:17.000Z","dependencies_parsed_at":"2022-09-26T20:31:51.152Z","dependency_job_id":null,"html_url":"https://github.com/AtropineTears/Selenite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtropineTears%2FSelenite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtropineTears%2FSelenite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtropineTears%2FSelenite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtropineTears%2FSelenite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AtropineTears","download_url":"https://codeload.github.com/AtropineTears/Selenite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113034,"owners_count":21049769,"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":["certificate","crate","crypto","cryptography","digital-signature","falcon","library","post-quantum","post-quantum-cryptography","pqcrypto","rust","rust-lang","sphincs"],"created_at":"2024-09-24T20:18:03.586Z","updated_at":"2025-04-09T21:23:07.626Z","avatar_url":"https://github.com/AtropineTears.png","language":"Rust","readme":"# Selenite\n\n![Crates.io](https://img.shields.io/crates/v/selenite?style=flat-square)\n[![Build Status](https://app.travis-ci.com/AtropineTears/Selenite.svg?branch=master)](https://app.travis-ci.com/AtropineTears/Selenite)\n![Crates.io](https://img.shields.io/crates/l/Selenite?style=flat-square)\n\nAn experimental rust crate for **Post-Quantum Code-Signing Certificates**.\n\nAll Digital Signatures are **Round Three NIST Post-Quantum Candidates** which are listed [here](https://csrc.nist.gov/Projects/post-quantum-cryptography/round-3-submissions).\n\nPlease read the [documentation](https://docs.rs/selenite/0.2.1/selenite/crypto/index.html) for usage.\n\n## Overview\n\n**Digital Signatures:** \n\n* SPHINCS+\n* FALCON512 and FALCON1024\n* ED25519\u003csup\u003e*\u003c/sup\u003e\n* BLS\u003csup\u003e*\u003c/sup\u003e\n\n\\*: Not Post-Quantum Cryptography\n\n## Example Usage\n\n### SPHINCS+ (SHAKE256)\n\nRead [SPHINCS+](https://sphincs.org/)\n\n**SPHINCS+** is a Stateless Hash-Based Signature Scheme taking its cryptographic assumptions against Quantum Computers from cryptographic hash functions.\n\nThis Digital Signature implementation reaches a **Security Level of 5**, which is the most secure a signature can be, by using the hash function **SHAKE256** and setting other security parameters. However, SPHINCS+ has slow verification time compared to other choices.\n\n* **SPHINCS+ Version:** sphincsshake256256srobust\n\n* **Public Key Size:** 64 bytes \n\n* **Private Key Size:** 128 bytes\n\n* **Signature Size:** 29,792 bytes\n\n```rust\nuse selenite::crypto::*;\n\nfn main() {\n    // Generates The Respected Keypair\n    let keypair = SphincsKeypair::new();\n\n    // Signs The Message as a UTF-8 Encoded String\n    let mut signature = keypair.sign(\"message_to_sign\");\n\n    // Returns a boolean representing whether the signature is valid or not\n    let is_verified = signature.verify();\n}\n```\n### FALCON512/FALCON1024\n\nRead [FALCON](https://falcon-sign.info/)\n\nFALCON is a lattice-based signature scheme whos underlying problem is based upon the short integer solution problem (SIS) over NTRU lattices, for which no efficient solving algorithm is currently known in the general case, even with the help of quantum computers. Falcon512 is similar in classical security assumptions to the security of RSA2048.\n\n* **Public Key Size:** 897 bytes | 1793 bytes\n\n* **Private Key Size:** 1281 bytes | 2305 bytes\n\n* **Signature Size:** 660 bytes | 1280 bytes\n\n\n```rust\nuse selenite::crypto::*;\n\nfn main(){\n    // Generates FALCON512 Keypair\n    let keypair = Falcon512Keypair::new();\n    \n    // Generates FALCON1024 Keypair\n    let keypair2 = Falcon1024Keypair::new();\n    \n    // Signs The Message as a UTF-8 Encoded String using the first keypair (FALCON512)\n    let signature = keypair.sign(\"Message1\");\n    \n    // Returns a boolean representing whether the signature is valid or not\n    let is_verified = signature.verify();\n}\n```\n\n### ED25519\n\nED25519 is an elliptic-curve based digital signature by DJB that has small public keys, private keys, and signatures.\n\nIt is not post-quantum secure but has been included in this library.\n\n* **Public Key Size:** 32 bytes\n\n* **Private Key Size:** 32 bytes\n\n* **Signature Size:** 64 bytes\n\n\n```rust\nuse selenite::crypto::*;\n\nfn main(){\n    // Generates ED25519 Keypair\n    let keypair = ED25519::new();\n    \n  \t// Signs Message\n    let signature = keypair.sign(\"Message1\");\n    \n    // Returns a boolean representing whether the signature is valid or not\n    let is_verified = signature.verify();\n}\n```\n\n### BLS Signature\n\nBLS is a pairing friendly elliptic curve that allows aggregation of signatures. Aggregation of signatures allow you to combine multiple signatures into a single one. Selenite supports aggregation (although it is still in the works).\n\n```rust\nuse selenite::crypto::*;\n\nfn main() {\n    let keypair = BLSKeypair::new();\n    \n    let keypair2 = BLSKeypair::new();\n    \n    let signature = keypair.sign(\"This message is being signed by BLS\");\n    \n    let signature2 = keypair2.sign(\"This message is also being signed by BLS\");\n    \n    let is_verified = signature.verify();\n       \n}\n```\n\n### Serialization\n\nYou can **Serialize** keypairs to YAML using serde-yaml.\n\n```rust\nfn serialize(){\n    // Generates Keypair\n    let keypair = SphincsKeypair::new();\n    \n    // Serializes Keypair To YAML\n    let yaml = keypair.serialize();\n    \n    // Deserializes Keypair To Respected Struct\n    let keypair_from_yaml = SphincsKeypair::deserialize(\u0026yaml);\n}\n\n```\n\n```rust\nfn serialize_signature(){\n    // Generates Keypair\n    let keypair = SphincsKeypair::new();\n\n    // Generates Signature\n    let signature = keypair.sign(\"Hello World!\");\n\n    // [BINCODE] Serialize To Bincode\n    let bincode: Vec\u003cu8\u003e = signature.serialize_to_bincode();\n\n    // [YAML] Serialize To YAML\n    let yaml = signature.serialize();\n}\n```\n\n### Randomness From CSPRNG\n\nSelenite allows you to easily get secure randomness from your operating system.\n\n```rust\nuse selenite::random::OsRandom;\n\nfn main() {\n    let randomness_32 = OsRandom::rand_32.expect(\"Failed To Get Randomness\");\n\n    let randomness_64 = OsRandom::rand_64.expect(\"Failed To Get Randomness\");\n\n    let randomness_128 = OsRandom::rand_128.expect(\"Failed To Get Randomness\");\n}\n```\n\n### Create SPHINCS+ Certificate\n\n```rust\nuse selenite::crypto::SphincsKeypair;\nuse selenite::certificate::*;\n\nfn main(){\n    let (cert,keypair) = SeleniteCertificate::new(\n        String::from(\"Subject Name\"),\n        CertificateType::INDIVIDUAL,\n        Some(String::from(\"[Optional] Username\")),\n        vec![KeyUsage::CODE_SIGNING,KeyUsage::DOCUMENT_SIGNING,KeyUsage::REVOCATION],\n        Some(String::from(\"[Optional] Email Address\")),\n        Some(String::from(\"[Optional] Phone Number\")),\n        Some(String::from(\"[Optional] Address\")),\n        Some(String::from(\"[Optional] Backup Email\")),\n        Some(String::from(\"[Optional] Backup Phone Number\")),\n        Some(String::from(\"[Optional] Description\")),\n        Some(String::from(\"[Optional] Website\")),\n        Some(String::from(\"[Optional] @Github\")),\n        Some(String::from(\"[Optional] @Reddit\")),\n        Some(String::from(\"[Optional] @Twitter\")),\n        Some(String::from(\"[Optional] @Keybase\")),\n        Some(String::from(\"[Optional] Bitcoin Address (BTC)\")),\n        Some(String::from(\"[Optional] Ethereum Address (ETH)\")),\n        Some(String::from(\"[Optional] Monero Address (XMR)\")),\n        Some(String::from(\"[Optional] Zcash Address (ZEC)\")),\n        Some(String::from(\"[Optional] PGP Key\")),\n        Some(String::from(\"[Optional] Onion Website\")),\n        Some(String::from(\"[Optional] Backup PGP Key\")),\n        Some(0usize), // (Optional) | Last_Bitcoin_Block_Height,\n        Some(String::from(\"[Optional] Last Bitcoin Block Hash\")),\n        );\n}\n```\n\n## To-Do\n\n* Add **[Dilithium](https://pq-crystals.org/dilithium/)**, another round three candidate\n\n* Add better **Serialization**\n\n* Add **Tests**\n\n* **Refactor Code**\n\n## Resources\n\n* [NIST Status Report](https://nvlpubs.nist.gov/nistpubs/ir/2020/NIST.IR.8309.pdf)\n\n* [NIST Round Three Submissions](https://csrc.nist.gov/Projects/post-quantum-cryptography/round-3-submissions)\n\n* [PQClean](https://github.com/pqclean/pqclean/)\n\n* [PQcrypto](https://github.com/rustpq/pqcrypto) | [Crate](https://crates.io/crates/pqcrypto)\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0\n\n* MIT license\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatropinetears%2Fselenite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatropinetears%2Fselenite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatropinetears%2Fselenite/lists"}