Download the PHP package pacoorozco/openssh without Composer
On this page you can find all versions of the php package pacoorozco/openssh. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pacoorozco/openssh
More information about pacoorozco/openssh
Files in pacoorozco/openssh
Package openssh
Short Description Creating and loading private/public OpenSSH keys
License MIT
Homepage https://github.com/pacoorozco/openssh
Informations about the package openssh
Creating and loading private/public OpenSSH keys
This package allows you to easily generate OpenSSH private/public key pairs, which can be used as authentication method in SSH connections.
Most functions in this package are wrappers around phpseclib functions.
Installation
You can install the package via composer:
Usage
You can generate a private key using the generate
function and saving it to a file:
Loading keys
To load a key from a file use the fromFile
static method:
Alternatively, you can also create a key object using a string.
At any time, you can obtain the public key from a private key
[RSA keys only] Encrypting a message with a public key, decrypting with the private key
Here's how you can encrypt data using the public key, and how to decrypt it using the private key.
If decrypt
cannot decrypt the given data (maybe a non-matching public key was used to encrypt the data, or maybe tampered with the data), an exception of class \PacoOrozco\OpenSSH\Exceptions\BadDecryptionException
will be thrown.
Determining if the data can be decrypted
The PrivateKey
class has a canDecrypt
method to determine if given data can be decrypted.
Signing and verifying data
The PrivateKey
class has a method sign
to generate a signature for the given data. The verify
method on the PublicKey
class can be used to verify if a signature is valid for the given data.
If verify
returns true
, you know for certain that the holder of the private key signed the message, and that it was not tampered with.
Validating inputs (Laravel)
You can use this library to validate form inputs.
To validate if an input is a valid public or private key you can use:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.