- Timestamp:
- 04/01/15 18:41:36 (9 years ago)
- Location:
- trunk/LATMOS-Accounts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/bin/la-sql-crypt-passwd
r1239 r1309 94 94 $clear_passwd{$_} = $clearp; 95 95 } else { 96 warn "$_:" . $rsa->errstr();96 die "Cannot get password for $_, crypt module said :" . $rsa->errstr(); 97 97 } 98 98 } -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r1286 r1309 12 12 use Crypt::RSA::Key::Public::SSH; 13 13 use Crypt::RSA::Key::Private::SSH; 14 use Crypt::RSA::Key::Public; 15 use Crypt::RSA::Key::Private; 14 16 use MIME::Base64; 15 17 … … 225 227 my ($public, $private) = $rsa->keygen ( 226 228 Identity => 'LATMOS-Accounts', 227 Size => 768,229 Size => 2048, 228 230 Password => $password, 229 231 Verbosity => 0, 230 KF=>'SSH',231 232 ) or die $rsa->errstr(); # TODO avoid die 232 233 return ($public, $private); … … 243 244 my $base = $self; 244 245 my $serialize = $base->get_global_value('rsa_private_key') or return; 245 my $privkey = Crypt::RSA::Key::Private::SSH->new; 246 $privkey->deserialize(String => [ decode_base64($serialize) ], 247 Passphrase => $password); 248 $privkey 246 my $string = decode_base64($serialize); 247 my $privkey = $string =~ /^SSH PRIVATE KEY FILE/ 248 ? Crypt::RSA::Key::Private::SSH->new 249 : Crypt::RSA::Key::Private->new; 250 $privkey = $privkey->deserialize( 251 String => [ $string ], 252 Password => $password 253 ); 254 $privkey->reveal( Password => $password ); 255 $privkey; 249 256 } 250 257 … … 280 287 my ($self, $public, $private) = @_; 281 288 my $base = $self; 289 $private->hide; 282 290 $base->set_global_value('rsa_private_key', 283 291 encode_base64($private->serialize)); -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm
r1308 r1309 524 524 525 525 if (my $serialize = $self->base->get_global_value('rsa_public_key')) { 526 my $public = Crypt::RSA::Key::Public ::SSH->new;527 $public ->deserialize(String => [ $serialize ]);526 my $public = Crypt::RSA::Key::Public->new; 527 $public = $public->deserialize(String => [ $serialize ]); 528 528 my $rsa = new Crypt::RSA ES => 'PKCS1v15'; 529 529 my $rsa_password = $rsa->encrypt ( … … 531 531 Key => $public, 532 532 Armour => 1, 533 ) || die $ self->poll->rsa->errstr();533 ) || die $rsa->errstr(); 534 534 if (!$self->_set_c_fields('encryptedPassword', $rsa_password)) { 535 535 $self->log(LA_ERR,
Note: See TracChangeset
for help on using the changeset viewer.