Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sergot/openssl
OpenSSL bindings for Perl 6
https://github.com/sergot/openssl
openssl openssl-bindings perl6 socket
Last synced: about 1 month ago
JSON representation
OpenSSL bindings for Perl 6
- Host: GitHub
- URL: https://github.com/sergot/openssl
- Owner: sergot
- License: mit
- Created: 2014-07-08T11:40:48.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2024-02-17T23:24:40.000Z (9 months ago)
- Last Synced: 2024-09-30T20:06:12.480Z (about 1 month ago)
- Topics: openssl, openssl-bindings, perl6, socket
- Language: Raku
- Size: 3.51 MB
- Stars: 14
- Watchers: 5
- Forks: 31
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
OpenSSL [![test](https://github.com/sergot/openssl/actions/workflows/test.yml/badge.svg)](https://github.com/sergot/openssl/actions/workflows/test.yml) [![Build status](https://ci.appveyor.com/api/projects/status/aix7xu5lpfs20ahw/branch/master?svg=true)](https://ci.appveyor.com/project/sergot/openssl/branch/master)
=======
OpenSSL bindings for Raku
## OpenSSL
Socket connection class. You probably want to use IO::Socket::SSL instead of this
(low-level) interface.use OpenSSL;
my $ssl = OpenSSL.new(:version(3), :client);
my $s = IO::Socket::INET.new(:$host, :port(443));
$ssl.set-socket($s);
$ssl.set-connect-state;
$ssl.connect
# $ssl.write, etc## OpenSSL::RSATools
Public key signing tools
use OpenSSL::RSATools;
my $pem = slurp 'key.pem';
my $rsa = OpenSSL::RSAKey.new(private-pem => $pem);
my $data = 'as df jk l';
my $signature = $rsa.sign($data.encode);
my $rsa = OpenSSL::RSAKey.new(public-pem => $public);
if $rsa.verify($data.encode, $signature) { ... }## OpenSSL::CryptTools
Symmetric encryption tools (currently only AES256/192/128 encrypt/decrypt)
use OpenSSL::CryptTools;
my $ciphertext = encrypt("asdf".encode,
:aes256,
:iv(("0" x 16).encode),
:key(('x' x 32).encode));
my $plaintext = decrypt($ciphertext,
:aes256,
:iv(("0" x 16).encode),
:key(('x' x 32).encode));## OpenSSL::Digest
Digest Functions (currently only md5/sha1/sha256/sha384/sha512)
use OpenSSL::Digest;
my Blob $digest = md5("xyz".encode);## OpenSSL::Digest::MD5
OO-Interface supporting incremental digesting
use OpenSSL::Digest::MD5;
my $md5 = OpenSSL::Digest::MD5.new; # Create fresh object
$md5.add('abc'); # pass in Str or Blob
$md5.add('def'); # Add some more data
my $digest = $md5.hash; # Blob hash (and reset)
$md5.addfile('myfile'); # Read a file
my $hexdigest = $md5.hex; # hex hash (and reset)