Ruby library for parsing SSH public keys and certificates
Перейти к файлу
Kevin Jones 1890c4bfc4
Merge pull request #30 from github/update-lock
Update lockfile version
2021-12-02 11:07:20 -05:00
.github/workflows Include Ruby 2.7 in test matrix 2021-03-03 12:01:57 -05:00
lib Bump version 2021-12-02 10:37:34 -05:00
spec Improve SK-EC tests. 2021-03-03 14:55:43 -05:00
.gitignore Ignore macOS generated files. 2021-03-03 13:59:58 -05:00
CODE_OF_CONDUCT.md make ready for opensourcing 2019-06-25 11:32:47 -06:00
CONTRIBUTING.md make ready for opensourcing 2019-06-25 11:32:47 -06:00
Gemfile first commit 2019-01-17 10:47:31 -07:00
Gemfile.lock Update lockfile version 2021-12-02 11:05:34 -05:00
LICENSE.md change ownership 2019-01-25 09:06:18 -07:00
README.md README: link to docs 2019-11-20 14:38:03 -07:00
ssh_data.gemspec Update development dependencies and test against Ruby 3.0 2021-03-02 10:40:31 -05:00

README.md

ssh_data docs

This is a Ruby library for processing SSH keys and certificates.

The scope of this project is limited to processing and directly using keys and certificates. It can be used to generate SSH private keys, verify signatures using public keys, sign data using private keys, issue certificates using private keys, and parse certificates and public and private keys. This library supports RSA, DSA, ECDSA, and ED25519* keys. This library does not offer or intend to offer functionality for SSH connectivity, processing of SSH wire protocol data, or processing of other key formats or types.

Project Status: Used by @github in production

Installation

gem install ssh_data

Usage

require "ssh_data"

key_data = File.read("~/.ssh/id_rsa.pub")
key = SSHData::PublicKey.parse_openssh(key_data)
#=> <SSHData::PublicKey::RSA>

cert_data = = File.read("~/.ssh/id_rsa-cert.pub")
cert = SSHData::Certificate.parse_openssh(cert_data)
#=> <SSHData::PublicKey::Certificate>

cert.key_id
#=> "mastahyeti"

cert.public_key
#=> <SSHData::PublicKey::RSA>

ED25519 support

Ruby's standard library does not include support for ED25519, though the algorithm is implemented by the ed25519 Gem. This library can parse ED25519 public and private keys itself, but in order to generate keys or sign or verify messages, the calling application must load the ed25519 Gem itself. This avoids the necessity of installing or loading this third party dependency when the calling application is only interested in parsing keys.

require "ssh_data"

key_data = File.read("~/.ssh/id_ed25519")
key = SSHData::PrivateKey.parse_openssh(key_data)
#=> <SSHData::PrivateKey::ED25519>

SSHData::PrivateKey::ED25519.generate
#=> raises SSHData::AlgorithmError

require "ed25519"

SSHData::PrivateKey::ED25519.generate
#=> <SSHData::PrivateKey::ED25519>

Contributions

This project is not currently seeking contributions for new features or functionality, though bug fixes are welcome. See CONTRIBUTING.md for more information.

License

This project is published under the MIT license. See LICENSE.md for mor information.