{"id":22153903,"url":"https://github.com/philr/putty-key","last_synced_at":"2025-07-26T06:32:29.013Z","repository":{"id":56889707,"uuid":"54917763","full_name":"philr/putty-key","owner":"philr","description":"Ruby PuTTY private key (.ppk) library. Supports reading and writing with a refinement to OpenSSL::PKey to allow key conversion.","archived":false,"fork":false,"pushed_at":"2024-10-16T11:19:58.000Z","size":116,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-18T09:26:53.894Z","etag":null,"topics":["ppk","putty","putty-private-key","puttygen","ruby","ssh"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/philr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2016-03-28T19:26:03.000Z","updated_at":"2024-10-16T11:12:40.000Z","dependencies_parsed_at":"2023-12-27T21:50:51.266Z","dependency_job_id":null,"html_url":"https://github.com/philr/putty-key","commit_stats":{"total_commits":85,"total_committers":1,"mean_commits":85.0,"dds":0.0,"last_synced_commit":"f0f0a1774f55cf079d113e1f59a1bc3b0339d435"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philr%2Fputty-key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philr%2Fputty-key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philr%2Fputty-key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philr%2Fputty-key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philr","download_url":"https://codeload.github.com/philr/putty-key/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227657173,"owners_count":17799911,"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":["ppk","putty","putty-private-key","puttygen","ruby","ssh"],"created_at":"2024-12-02T01:38:51.316Z","updated_at":"2025-07-26T06:32:28.993Z","avatar_url":"https://github.com/philr.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PuTTY::Key #\n\n[![RubyGems](https://img.shields.io/gem/v/putty-key?logo=rubygems\u0026label=Gem)](https://rubygems.org/gems/putty-key) [![Tests](https://github.com/philr/putty-key/actions/workflows/tests.yml/badge.svg?branch=master\u0026event=push)](https://github.com/philr/putty-key/actions?query=workflow%3ATests+branch%3Amaster+event%3Apush) [![Coverage Status](https://img.shields.io/coveralls/github/philr/putty-key/master?label=Coverage\u0026logo=Coveralls)](https://coveralls.io/github/philr/putty-key?branch=master)\n\nPuTTY::Key is a Ruby implementation of the PuTTY private key (ppk) format\n(versions 2 and 3), handling reading and writing .ppk files. It includes a\nrefinement to Ruby's OpenSSL library to add support for converting DSA, EC and\nRSA private keys to and from PuTTY private key files. This allows OpenSSH ecdsa,\nssh-dss and ssh-rsa private keys to be converted to and from PuTTY's private key\nformat.\n\n\n## Installation ##\n\nTo install the PuTTY::Key gem, run the following command:\n\n```bash\ngem install putty-key\n```\n\nTo add PuTTY::Key as a Bundler dependency, add the following line to your\n`Gemfile`:\n\n```ruby\ngem 'putty-key'\n```\n\n## Compatibility ##\n\nPuTTY::Key is compatible with Ruby MRI 2.1.0+ and JRuby 9.1.0.0+.\n\n\n## Formats ##\n\nFormat 2 and 3 .ppk files are supported. Format 1 (not supported) was only used\nbriefly early on in the development of the .ppk format and was never included in\na PuTTY release. Format 2 is supported by PuTTY version 0.52 onwards. Format 3\nis supported by PuTTY version 0.75 onwards. By default, `PuTTY::Key::PPK` saves\nfiles using format 2. Format 3 can be selected with the `format` parameter.\n\n[libargon2](https://github.com/P-H-C/phc-winner-argon2) is required to load and\nsave encrypted format 3 files. Binaries are typically available with your OS\ndistribution. For Windows, binaries are available from the\n[argon2-windows](https://github.com/philr/argon2-windows/releases) repository.\nUse either Argon2OptDll.dll for CPUs supporting AVX or Argon2RefDll.dll\notherwise.\n\n\n## Usage ##\n\nTo use PuTTY::Key, it must first be loaded with:\n\n```ruby\nrequire 'putty/key'\n```\n\nThe included [refinement](https://ruby-doc.org/core/doc/syntax/refinements_rdoc.html)\nto Ruby's OpenSSL library can then either be activated in the lexical scope\n(file, class or module) where it will be used with:\n\n```ruby\nusing PuTTY::Key\n```\n\nor installed globally by calling:\n\n```ruby\nPuTTY::Key.global_install\n```\n\nThe following sections give examples of how PuTTY::Key can be used.\n\n\n### Converting a .pem formatted key file to an unencrypted .ppk file ###\n\n```ruby\nrequire 'openssl'\nrequire 'putty/key'\nusing PuTTY::Key    # or PuTTY::Key.global_install\n\npem = File.read('key.pem', mode: 'rb')\npkey = OpenSSL::PKey.read(pem)\nppk = pkey.to_ppk\nppk.comment = 'Optional comment'\nppk.save('key.ppk')\n```\n\nUse `ppk.save('key.ppk', format: 3)` to save a format 3 file instead of\nformat 2.\n\n\n### Generating a new RSA key and saving it as an encrypted .ppk file ###\n\n```ruby\nrequire 'openssl'\nrequire 'putty/key'\nusing PuTTY::Key    # or PuTTY::Key.global_install\n\nrsa = OpenSSL::PKey::RSA.generate(2048)\nppk = rsa.to_ppk\nppk.comment = 'RSA 2048'\nppk.save('rsa.ppk', 'Passphrase for encryption')\n```\n\nUse `ppk.save('rsa.ppk', 'Passphrase for encryption', format: 3)` to save a\nformat 3 file instead of format 2.\n\n\n### Converting an unencrypted .ppk file to .pem format ###\n\n```ruby\nrequire 'openssl'\nrequire 'putty/key'\nusing PuTTY::Key    # or PuTTY::Key.global_install\n\nppk = PuTTY::Key::PPK.new('key.ppk')\npkey = OpenSSL::PKey.from_ppk(ppk)\npem = pkey.to_pem\nFile.write('key.pem', pem, mode: 'wb')\n```\n\n\n### Decrypting a .ppk file and re-saving it without encryption ###\n\n```ruby\nrequire 'putty/key'\n\nppk = PuTTY::Key::PPK.new('rsa.ppk', 'Passphrase for encryption')\nppk.save('rsa-plain.ppk')\n```\n\nUse `ppk.save('rsa-plain.ppk', format: 3)` to save a format 3 file instead of\nformat 2.\n\n\n## API Documentation ##\n\nAPI documentation for PuTTY::Key is available on\n[RubyDoc.info](https://www.rubydoc.info/gems/putty-key).\n\n\n## License ##\n\nPuTTY::Key is distributed under the terms of the MIT license. A copy of this\nlicense can be found in the included LICENSE file.\n\n\n## GitHub Project ##\n\nSource code, release information and the issue tracker can be found on the\n[PuTTY::Key GitHub project page](https://github.com/philr/putty-key).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilr%2Fputty-key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilr%2Fputty-key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilr%2Fputty-key/lists"}