Changeset 1309 for trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
- Timestamp:
- 04/01/15 18:41:36 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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));
Note: See TracChangeset
for help on using the changeset viewer.