{"id":44755012,"url":"https://github.com/serverscom/pgp-rb","last_synced_at":"2026-02-16T00:05:24.596Z","repository":{"id":224524282,"uuid":"763406530","full_name":"serverscom/pgp-rb","owner":"serverscom","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-21T13:11:22.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-22T22:19:20.306Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/serverscom.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":"2024-02-26T08:32:05.000Z","updated_at":"2025-08-21T13:14:09.000Z","dependencies_parsed_at":"2024-03-09T09:41:19.569Z","dependency_job_id":"bd55a906-030a-4f45-911d-0ba76a40b9dd","html_url":"https://github.com/serverscom/pgp-rb","commit_stats":null,"previous_names":["serverscom/pgp-rb"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/serverscom/pgp-rb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverscom%2Fpgp-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverscom%2Fpgp-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverscom%2Fpgp-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverscom%2Fpgp-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverscom","download_url":"https://codeload.github.com/serverscom/pgp-rb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverscom%2Fpgp-rb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29494289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T00:00:57.352Z","status":"ssl_error","status_checked_at":"2026-02-15T23:56:34.338Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-16T00:05:24.154Z","updated_at":"2026-02-16T00:05:24.577Z","avatar_url":"https://github.com/serverscom.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgp-rb\n\nA Ruby gem that provides PGP (Pretty Good Privacy) functionality through a fast Rust extension using the [rPGP](https://github.com/rpgp/rpgp) library.\n\n## Features\n\n- **Fast**: Built with Rust for high performance cryptographic operations\n- **Simple API**: Easy-to-use Ruby interface for PGP operations\n- **Key Parsing**: Parse and analyze both PGP public and private keys\n- **Encryption**: Encrypt data using PGP public keys with configurable algorithms\n- **Signing**: Sign messages using PGP private keys with various hash algorithms\n- **Key Information**: Extract fingerprints, algorithms, creation dates, and expiration dates\n- **Modern Crypto**: Supports RSA, EdDSA, ECDSA, and other modern algorithms\n- **Latest Dependencies**: Uses pgp 0.16.0, base64 0.22.1, and other up-to-date Rust crates\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'pgp-rb'\n```\n\nAnd then execute:\n\n```bash\n$ bundle install\n```\n\nOr install it yourself as:\n\n```bash\n$ gem install pgp-rb\n```\n\n## Usage\n\n### Parsing PGP Public Keys\n\n```ruby\nrequire 'pgp'\n\n# Load a PGP public key from a file or string\nkey_data = File.read('path/to/public_key.asc')\npublic_key = PGP::PublicKey.parse(key_data)\n\n# Get key information\nputs public_key.fingerprint        # Key fingerprint in uppercase hex\nputs public_key.algorithm          # Algorithm ID (1 for RSA, 22 for EdDSA, etc.)\nputs public_key.version           # Key version (4, 5, 6)\nputs public_key.created_at        # Creation timestamp\nputs public_key.expires_at        # Expiration timestamp (nil if no expiration)\n\n# Check key capabilities\nputs public_key.signing_supported?      # Can this key be used for signing?\nputs public_key.encryption_supported?   # Can this key be used for encryption?\n```\n\n### Parsing PGP Private Keys\n\n```ruby\nrequire 'pgp'\n\n# Load a PGP private key from a file or string\nprivate_key_data = File.read('path/to/private_key.asc')\nprivate_key = PGP::PrivateKey.parse(private_key_data)\n\n# Get key information (same methods as public keys)\nputs private_key.fingerprint        # Key fingerprint in uppercase hex\nputs private_key.algorithm          # Algorithm ID (1 for RSA, 22 for EdDSA, etc.)\nputs private_key.version            # Key version (4, 5, 6)\nputs private_key.created_at         # Creation timestamp\nputs private_key.expires_at         # Expiration timestamp (nil if no expiration)\n\n# Check key capabilities\nputs private_key.signing_supported?      # Can this key be used for signing?\nputs private_key.encryption_supported?   # Can this key be used for encryption?\n```\n\n### Signing Messages\n\n```ruby\nrequire 'pgp'\n\n# Parse a private key\nprivate_key_data = File.read('path/to/private_key.asc')\nprivate_key = PGP::PrivateKey.parse(private_key_data)\n\n# Sign a message with default hash algorithm (SHA-256)\nsignature = private_key.sign(\"Hello, World!\")\n\n# Sign with a specific hash algorithm\n# Hash algorithm constants:\n# PGP::HASH_ALGORITHM_MD5 = 1\n# PGP::HASH_ALGORITHM_SHA1 = 2\n# PGP::HASH_ALGORITHM_SHA256 = 8\n# PGP::HASH_ALGORITHM_SHA384 = 9\n# PGP::HASH_ALGORITHM_SHA512 = 10\nsignature = private_key.sign_with_algorithm(\"Secret message\", PGP::HASH_ALGORITHM_SHA512)\n\n# The result is base64-encoded signature data\nputs signature\n```\n\n### Encrypting Data\n\n```ruby\nrequire 'pgp'\n\n# Parse a public key\nkey_data = File.read('recipient_public_key.asc')\npublic_key = PGP::PublicKey.parse(key_data)\n\n# Encrypt a message with default algorithm (AES-128)\nencrypted_data = public_key.encrypt(\"Hello, World!\")\n\n# Encrypt with a specific symmetric algorithm\n# Algorithm constants:\n# PGP::KEY_ALGORITHM_AES_128 = 7\n# PGP::KEY_ALGORITHM_AES_192 = 8\n# PGP::KEY_ALGORITHM_AES_256 = 9\nencrypted_data = public_key.encrypt_with_algorithm(\"Secret message\", PGP::KEY_ALGORITHM_AES_256)\n\n# The result is base64-encoded encrypted data\nputs encrypted_data\n```\n\n### Algorithm Constants\n\nThe gem provides constants for symmetric encryption algorithms:\n\n```ruby\nPGP::KEY_ALGORITHM_IDEA = 1\nPGP::KEY_ALGORITHM_TRIPLE_DES = 2\nPGP::KEY_ALGORITHM_CAST5 = 3\nPGP::KEY_ALGORITHM_BLOWFISH = 4\nPGP::KEY_ALGORITHM_AES_128 = 7\nPGP::KEY_ALGORITHM_AES_192 = 8\nPGP::KEY_ALGORITHM_AES_256 = 9\nPGP::KEY_ALGORITHM_TWOFISH = 10\nPGP::KEY_ALGORITHM_CAMELLIA_128 = 11\nPGP::KEY_ALGORITHM_CAMELLIA_192 = 12\nPGP::KEY_ALGORITHM_CAMELLIA_256 = 13\n```\n\nAnd constants for hash algorithms used in signing:\n\n```ruby\nPGP::HASH_ALGORITHM_MD5 = 1\nPGP::HASH_ALGORITHM_SHA1 = 2\nPGP::HASH_ALGORITHM_SHA256 = 8\nPGP::HASH_ALGORITHM_SHA384 = 9\nPGP::HASH_ALGORITHM_SHA512 = 10\nPGP::HASH_ALGORITHM_SHA224 = 11\nPGP::HASH_ALGORITHM_SHA3_256 = 12\nPGP::HASH_ALGORITHM_SHA3_512 = 14\n```\n\n### Error Handling\n\nThe gem defines specific error classes:\n\n```ruby\nbegin\n  public_key = PGP::PublicKey.parse(invalid_key_data)\nrescue PGP::ParseError =\u003e e\n  puts \"Failed to parse key: #{e.message}\"\nend\n\nbegin\n  encrypted = signing_only_key.encrypt(\"data\")\nrescue PGP::EncryptionError =\u003e e\n  puts \"Encryption failed: #{e.message}\"\nend\n\nbegin\n  signature = private_key.sign(\"data\")\nrescue PGP::SigningError =\u003e e\n  puts \"Signing failed: #{e.message}\"\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.\n\n### Building the Extension\n\nThis gem uses a Rust extension for performance. To build:\n\n```bash\nbundle exec rake compile\n```\n\n### Running Tests\n\n```bash\nbundle exec rspec\n```\n\n### Generating Test Keys\n\nThe repository includes a script to generate test keys for development:\n\n```bash\nruby generate_test_keys.rb\n```\n\nThis script will generate RSA and ECC key pairs (both public and private) and place them in the `spec/fixtures/` directory.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/serverscom/pgp-rb.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverscom%2Fpgp-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverscom%2Fpgp-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverscom%2Fpgp-rb/lists"}