- Timestamp:
- 04/01/15 18:45:08 (9 years ago)
- Location:
- branches/4.0
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0
-
branches/4.0/LATMOS-Accounts/bin/la-sql-crypt-passwd
r1239 r1310 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 } -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r1294 r1310 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)); -
branches/4.0/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/objects.pm
r1301 r1310 493 493 494 494 if (my $serialize = $self->base->get_global_value('rsa_public_key')) { 495 my $public = Crypt::RSA::Key::Public ::SSH->new;496 $public ->deserialize(String => [ $serialize ]);495 my $public = Crypt::RSA::Key::Public->new; 496 $public = $public->deserialize(String => [ $serialize ]); 497 497 my $rsa = new Crypt::RSA ES => 'PKCS1v15'; 498 498 my $rsa_password = $rsa->encrypt ( … … 500 500 Key => $public, 501 501 Armour => 1, 502 ) || die $ self->poll->rsa->errstr();502 ) || die $rsa->errstr(); 503 503 if (!$self->_set_c_fields('encryptedPassword', $rsa_password)) { 504 504 $self->log(LA_ERR,
Note: See TracChangeset
for help on using the changeset viewer.