Skip to content

Commit 45b0fa2

Browse files
committed
rename new parameter before release
1 parent 48713f6 commit 45b0fa2

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

lib/XML/Enc.pm

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,21 +135,23 @@ Used in encryption. Optional. Default method: aes256-cbc
135135
136136
Specify the encryption method to be used for key transport. Supported methods are:
137137
138-
Used in encryption. Optional. Default method: rsa-1_5
138+
Used in encryption. Optional. Default method: rsa-oaep-mgf1p
139139
140140
=over
141141
142142
=item * L<rsa-1_5|https://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-1_5>
143143
144144
=item * L<rsa-oaep-mgf1p|https://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#rsa-oaep-mgf1p>
145145
146-
=item * L<rsa-oaep (Experimental)| http://www.w3.org/2009/xmlenc11#rsa-oaep>
146+
=item * L<rsa-oaep|http://www.w3.org/2009/xmlenc11#rsa-oaep>
147147
148148
=back
149149
150-
=item B<oaep_method>
150+
=item B<oaep_mgf_alg>
151151
152-
Specify the Algorithm to be used for rsa-oaep. Supported methods are:
152+
Specify the Algorithm to be used for rsa-oaep. Supported algorithms are:
153+
154+
Used in encryption. Optional. Default method: mgf1sha1
153155
154156
=over
155157
@@ -194,8 +196,8 @@ sub new {
194196
my $key_method = exists($params->{'key_transport'}) ? $params->{'key_transport'} : 'rsa-oaep-mgf1p ';
195197
$self->{'key_transport'} = $self->_setKeyEncryptionMethod($key_method);
196198

197-
my $oaep_method = exists($params->{'oaep_method'}) ? $params->{'oaep_method'} : 'http://www.w3.org/2009/xmlenc11#mgf1sha1';
198-
$self->{'oaep_method'} = $self->_setOAEPAlgorithm($oaep_method);
199+
my $oaep_mgf_alg = exists($params->{'oaep_mgf_alg'}) ? $params->{'oaep_mgf_alg'} : 'http://www.w3.org/2009/xmlenc11#mgf1sha1';
200+
$self->{'oaep_mgf_alg'} = $self->_setOAEPAlgorithm($oaep_mgf_alg);
199201

200202
$self->{'oaep_params'} = exists($params->{'oaep_params'}) ? $params->{'oaep_params'} : '';
201203

@@ -558,7 +560,7 @@ sub _EncryptKey {
558560
${$key} = $rsa_pub->encrypt(${$key}, 'oaep', 'SHA1', $self->{oaep_params});
559561
}
560562
elsif ($keymethod eq 'http://www.w3.org/2009/xmlenc11#rsa-oaep') {
561-
${$key} = $rsa_pub->encrypt(${$key}, 'oaep', $self->_getOAEPAlgorithm($self->{oaep_method}), $self->{oaep_params});
563+
${$key} = $rsa_pub->encrypt(${$key}, 'oaep', $self->_getOAEPAlgorithm($self->{oaep_mgf_alg}), $self->{oaep_params});
562564
} else {
563565
die "Unsupported Key Encryption Method";
564566
}
@@ -919,7 +921,7 @@ sub _create_encrypted_data_xml {
919921
$kencmethod,
920922
'xenc:MGF',
921923
{
922-
Algorithm => $self->{oaep_method},
924+
Algorithm => $self->{oaep_mgf_alg},
923925
}
924926
);
925927
};

t/06-test-encryption-methods.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ XML
1414

1515
my @key_methods = qw/rsa-1_5 rsa-oaep-mgf1p/;
1616
my @data_methods = qw/aes128-cbc aes192-cbc aes256-cbc tripledes-cbc aes128-gcm aes192-gcm aes256-gcm/;
17-
my @oaep_methods = qw/mgf1sha1 mgf1sha224 mgf1sha256 mgf1sha384 mgf1sha512/;
17+
my @oaep_mgf_algs = qw/mgf1sha1 mgf1sha224 mgf1sha256 mgf1sha384 mgf1sha512/;
1818

1919
foreach my $km (@key_methods) {
2020
foreach my $dm (@data_methods) {
@@ -51,15 +51,15 @@ foreach my $km (@key_methods) {
5151
}
5252
}
5353

54-
foreach my $om (@oaep_methods) {
54+
foreach my $om (@oaep_mgf_algs) {
5555
foreach my $dm (@data_methods) {
5656
my $encrypter = XML::Enc->new(
5757
{
5858
key => 't/sign-private.pem',
5959
cert => 't/sign-certonly.pem',
6060
data_enc_method => $dm,
6161
key_transport => 'rsa-oaep',
62-
oaep_method => $om,
62+
oaep_mgf_alg => $om,
6363
no_xml_declaration => 1
6464
}
6565
);

0 commit comments

Comments
 (0)