Git Product home page Git Product logo

crypt-rsa-simple's Introduction

NAME

Crypt::RSA::Simple - Encrypts/decrypts text with RSA keys

SYNOPSIS

use Crypt::RSA::Simple;

my $crypt = Crypt::RSA::Simple->new(
  key_dir     => '/home/user/keys',
  key_size    => 2048,
  private_key => 'secure_key.priv',
  public_key  => 'secure_key.pub',
);

$crypt->generate()

Or it can be fed with method arguments:

my $crypt = Crypt::RSA::Simple->new();

$crypt->generate(
  '/home/user/keys',
  2048,
  'secure_key.priv',
  'secure_key.pub'
);

Private and public keys can be set with their getter/setter methods as well as the key_dir and key_size:

my $crypt->private_key( '/home/user/keys/secret.priv' );
my $crypt->public_key( '/home/user/keys/secret.pub' );

my $crypted   = $crypt->encrypt( 'text to crypt' );
my $encrypted = $crypt->decrypt( $crypted );

Or keys can be used with the crypt and decrypt methods as their arguments as well:

my $decrypted = $crypt->decrypt(
  'encrypted text',
  '/home/user/keys/secret.priv'
);

Class methods and instance methods are both supported:

Crypt::RSA::Simple->encrypt( 'text', '/home/user/keys/secret.pub' );

DESCRIPTION

Crypt::RSA::Simple is just a tiny but flexible wrapper on the top of the Crypt::OpenSSL::RSA library. It encrypts and decrypts any text, and it can generate RSA keys if necessary.

This tool does not give any new features to the original module, rather it wraps it into an easy-to-use form. It offers an elegant, pure Perl OO interface.

It uses MIME::Base64 to encode/decode the crypted text, makes it easier to store it on a drive e.g. in a file.

METHODS

new:

Creates a new Crypt::RSA::Simple object instance

Arguments:

key_dir: Path to the key directory (String)

key_size: Key size for key generation (Integer)

private_key: Name of the key (String)

public_key: Name of the key (String)

All parameters can be set with getter/setter methods

private_key:

Getter/setter method for the private key

public_key:

Getter/setter method for the public key

key_dir:

Getter/setter method for the key directory

key_size:

Getter/setter method for the key size

generate:

Method for private and public key generation

Arguments:

key_dir: Path to the key directory (String)

key_size: Key size for key generation (Integer)

private_key: Name of the key (String)

public_key: Name of the key (String)

This method generates a key pair into the key_dir to encrypt and decrypt with. If it is called without arguments it uses the default values.

encrypt

Method for text encrytion

Arguments:

text: Text to be encrypted (String)

public_key: Public key for encryption (String)

decrypt

Method for decrypting ecrypted text

Arguments:

text: Text to be decrypted (String)

private_key: Private key for encryption (String)

NON-CORE DEPENDENCIES

Crypt::OpenSSL::RSA

AUTHOR

Tamas Molnar <[email protected]>

COPYRIGHT AND LICENSE

Copyright 2016, Tamas Molnar

This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Crypt::OpenSSL::RSA

MIME::Base64

crypt-rsa-simple's People

Contributors

etamsmo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

fr34k8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.