sshkey_utilities

Utility functions for manipulating ssh keys

Tomas Doran

bobtfish

9,176 downloads

9,024 latest version

3.9 quality score

Version information

  • 0.0.2 (latest)
  • 0.0.1
released Nov 9th 2013

Start using this module

Documentation

bobtfish/sshkey_utilities — version 0.0.2 Nov 9th 2013

#sshkey_utilities

[Build Status

####Table of Contents

  1. Overview
  2. Reference - Functions included
  3. Limitations - OS compatibility, etc.
  4. Development - Guide for contributing to the module

##Overview

Provides funcions for manipulating ssh private and public keys from strings.

If you want to work on ssh keys in files then you can use the built in file() function to read them in, or my enhanced better_file module

##Reference

sshkey_fingerprint_from_public_key

Takes the public key text as a parameter and returns the key fingerprint.

For example:

$public_key = file('/etc/ssh/host_rsa_key.pub')
$fingerprint = sshkey_fingerprint_from_public_key($public_key)

sshkey_public_key_from_private_key

Generates and returns the public key corresponding to a given private key, the text of which should be supllied as a parameter.

The private key must not have a passphrase.

For example:

$private_key = file('/etc/ssh/host_rsa_key')
$public_key = sshkey_public_key_from_private_key($private_key)

##Limitations

This module should be compatible with any POSIX system which ships a 'setsid' command.

If your unix doesn't (coughApplecough) then see here: https://github.com/jerrykuch/ersatz-setsid

##Development

Patches welcome! Please send pull requests or suggestions on github.