Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
964 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/.build/ | ||
/_build/ | ||
/Build | ||
/Build.bat | ||
/blib | ||
/Makefile | ||
/pm_to_blib | ||
|
||
/carton.lock | ||
/.carton/ | ||
/local/ | ||
|
||
nytprof.out | ||
nytprof/ | ||
|
||
cover_db/ | ||
|
||
*.bak | ||
*.old | ||
*~ | ||
*.swp | ||
*.o | ||
*.obj | ||
|
||
!LICENSE | ||
|
||
/_build_params | ||
|
||
MYMETA.* | ||
|
||
/Crypt-RFC8188-* | ||
|
||
/MANIFEST.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
language: perl | ||
jobs: | ||
include: | ||
- perl: "5.10.0" | ||
- perl: "5.26" | ||
env: AUTHOR_TESTING=1 RELEASE_TESTING=1 | ||
# separate from author testing else cover_db blows up xt/manifest.t | ||
- perl: "5.26" | ||
env: COVERAGE=1 | ||
before_install: | ||
- git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers | ||
- source ~/travis-perl-helpers/init | ||
- build-perl | ||
- local-lib cache | ||
- perl -V | ||
- if [ "$AUTHOR_TESTING" = 1 ]; then prove -l xt; fi | ||
- build-dist | ||
- cd $BUILD_DIR # $BUILD_DIR is set by the build-dist command | ||
install: | ||
- cpan-install --deps # installs prereqs, including recommends | ||
- cpan-install --coverage # installs coverage prereqs, if enabled | ||
before_script: | ||
- coverage-setup | ||
script: | ||
- prove -l -j$(test-jobs) $(test-files) # parallel testing | ||
after_success: | ||
- coverage-report | ||
notifications: | ||
irc: | ||
channels: | ||
- "irc.perl.org#graphql-perl" | ||
on_failure: always | ||
skip_join: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
0.01 2020-06-02 | ||
- first version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Changes | ||
lib/Crypt/RFC8188.pm | ||
Makefile.PL | ||
MANIFEST This list of files | ||
README.md | ||
t/00-report-prereqs.t | ||
t/ece.t | ||
xt/manifest.t | ||
xt/pod.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
MANIFEST.SKIP | ||
^cover_db\/ | ||
MANIFEST.bak | ||
.git\/ | ||
^.gitignore | ||
^.travis.yml | ||
blib\/ | ||
MYMETA\..* | ||
^Crypt-RFC8188-\d.* | ||
^Makefile$ | ||
^Makefile.bak$ | ||
pm_to_blib | ||
\.swp$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use strict; | ||
use warnings; | ||
use ExtUtils::MakeMaker; | ||
|
||
WriteMakefile( | ||
NAME => 'Crypt::RFC8188', | ||
AUTHOR => q{Ed J <etj@cpan.org>}, | ||
VERSION_FROM => 'lib/Crypt/RFC8188.pm', | ||
ABSTRACT_FROM => 'lib/Crypt/RFC8188.pm', | ||
LICENSE => 'artistic_2', | ||
MIN_PERL_VERSION => '5.010000', # pack "*>" | ||
CONFIGURE_REQUIRES => { | ||
'ExtUtils::MakeMaker' => '7.10', | ||
}, | ||
TEST_REQUIRES => { | ||
'Test::More' => '0.98', | ||
}, | ||
PREREQ_PM => { | ||
'CryptX' => '0.068', | ||
'Exporter' => '5.57', | ||
'MIME::Base64' => '3.11', | ||
'Math::BigInt' => '1.999804', # from_bytes | ||
}, | ||
clean => { FILES => 'Crypt-RFC8188-*' }, | ||
META_MERGE => { | ||
"meta-spec" => { version => 2 }, | ||
dynamic_config => 0, | ||
resources => { | ||
x_IRC => 'irc://irc.perl.org/#graphql-perl', | ||
repository => { | ||
type => 'git', | ||
url => 'git@github.com:mohawk2/Crypt-RFC8188.git', | ||
web => 'https://github.com/mohawk2/Crypt-RFC8188', | ||
}, | ||
bugtracker => { | ||
web => 'https://github.com/mohawk2/Crypt-RFC8188/issues', | ||
}, | ||
license => [ 'http://dev.perl.org/licenses/' ], | ||
}, | ||
prereqs => { | ||
develop => { | ||
requires => { | ||
'Test::Pod' => '1.22', | ||
'Pod::Markdown' => 0, | ||
}, | ||
}, | ||
}, | ||
}, | ||
); | ||
|
||
sub MY::postamble { | ||
<<EOF; | ||
pure_all :: README.md | ||
README.md : \$(VERSION_FROM) | ||
\tpod2markdown \$< >\$\@ | ||
EOF | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# NAME | ||
|
||
Crypt::RFC8188 - Implement RFC 8188 HTTP Encrypted Content Encoding | ||
|
||
# PROJECT STATUS | ||
|
||
| OS | Build status | | ||
|:-------:|--------------:| | ||
| Linux | [![Build Status](https://travis-ci.org/mohawk2/Crypt-RFC8188.svg?branch=master)](https://travis-ci.org/mohawk2/Crypt-RFC8188) | | ||
|
||
[![CPAN version](https://badge.fury.io/pl/Crypt-RFC8188.svg)](https://metacpan.org/pod/Crypt-RFC8188) [![Coverage Status](https://coveralls.io/repos/github/mohawk2/Crypt-RFC8188/badge.svg?branch=master)](https://coveralls.io/github/mohawk2/Crypt-RFC8188?branch=master) | ||
|
||
# SYNOPSIS | ||
|
||
use Crypt::RFC8188 qw(ece_encrypt_aes128gcm ece_decrypt_aes128gcm); | ||
my $ciphertext = ece_encrypt_aes128gcm( | ||
$plaintext, $salt, $key, $private_key, $dh, $auth_secret, $keyid, $rs, | ||
); | ||
my $plaintext = ece_decrypt_aes128gcm( | ||
# no salt, keyid, rs as encoded in header | ||
$ciphertext, $key, $private_key, $dh, $auth_secret, | ||
); | ||
|
||
# DESCRIPTION | ||
|
||
This module implements RFC 8188, the HTTP Encrypted Content Encoding | ||
standard. Among other things, this is used by Web Push (RFC 8291). | ||
|
||
It implements only the `aes128gcm` (Advanced Encryption Standard | ||
128-bit Galois/Counter Mode) encryption, not the previous draft standards | ||
envisaged for Web Push. It implements neither `aesgcm` nor `aesgcm128`. | ||
|
||
# FUNCTIONS | ||
|
||
Exportable (not by default) functions: | ||
|
||
## ece\_encrypt\_aes128gcm | ||
|
||
Arguments: | ||
|
||
### $plaintext | ||
|
||
The plain text. | ||
|
||
### $salt | ||
|
||
A randomly-generated 16-octet sequence. If not provided, one will be | ||
generated. This is still useful as the salt is included in the ciphertext. | ||
|
||
### $key | ||
|
||
A secret key to be exchanged by other means. | ||
|
||
### $private\_key | ||
|
||
The private key of a [Crypt::PK::ECC](https://metacpan.org/pod/Crypt::PK::ECC) Prime 256 ECDSA key. | ||
|
||
### $dh | ||
|
||
If the private key above is provided, this is the recipient's public | ||
key of an Prime 256 ECDSA key. | ||
|
||
### $auth\_secret | ||
|
||
An authentication secret. | ||
|
||
### $keyid | ||
|
||
If provided, the ID of a key to be looked up by other means. | ||
|
||
### $rs | ||
|
||
The record size for encrypted blocks. Must be at least 18, which would | ||
be very inefficient as the overhead is 17 bytes. Defaults to 4096. | ||
|
||
## ece\_decrypt\_aes128gcm | ||
|
||
### $ciphertext | ||
|
||
The plain text. | ||
|
||
### $key | ||
|
||
### $private\_key | ||
|
||
### $dh | ||
|
||
### $auth\_secret | ||
|
||
All as above. `$salt`, `$keyid`, `$rs` are not given since they are | ||
encoded in the ciphertext. | ||
|
||
# SEE ALSO | ||
|
||
[https://github.com/web-push-libs/encrypted-content-encoding](https://github.com/web-push-libs/encrypted-content-encoding) | ||
|
||
RFC 8188 - Encrypted Content-Encoding for HTTP (using `aes128gcm`). | ||
|
||
# AUTHOR | ||
|
||
Ed J, `<etj at cpan.org>` | ||
|
||
# LICENSE | ||
|
||
Copyright (C) Ed J | ||
|
||
This library is free software; you can redistribute it and/or modify | ||
it under the same terms as Perl itself. |
Oops, something went wrong.