AES128 - 128BIT CTR mode AES algorithm.
# ------------------------ simple version ---------------------------------- use AES128 qw/:all/; my $plain_text = "There's more than one way to do it."; my $key = "my secret aes key."; my $encrypted = AES128_CTR_encrypt($plain_text, $key); my $plain = AES128_CTR_decrypt($encrypted, $key); # ------------ server/client key exchange ----------------------------------- use MicroECC; use AES128 qw/:all/; use Digest::SHA qw/sha256/; my $curve = MicroECC::secp256r1(); my ($server_pubkey, $server_privkey) = MicroECC::make_key($curve); # Generate shared secret with client public key. my $shared_secret = MicroECC::shared_secret($client_pubkey, $server_privkey); my $key = sha256($shared_secret); my $plain_text = "There's more than one way to do it."; my $encrypted = AES128_CTR_encrypt($plain_text, $key); my $plain = AES128_CTR_decrypt($encrypted, $key);
Perl wrapper for the tiny-AES-c library (https://github.com/kokke/tiny-AES-c)
Since 128bit key length is secure enough for most applications and ECB is NOT secure, this module supports 128bit key length and CTR mode only.
None by default.
The tiny-AES-c library: https://github.com/kokke/tiny-AES-c
Jeff Zhang, <10395708@qq.com>
Copyright (C) 2019 by Jeff
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.16.1 or, at your option, any later version of Perl 5 you may have available.
To install AES128, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AES128
CPAN shell
perl -MCPAN -e shell install AES128
For more information on module installation, please visit the detailed CPAN module installation guide.