@@ -183,9 +183,7 @@ impl SignBuilder {
183
183
signing_key : & str ,
184
184
) -> Result < PathBuf , SignBuilderError > {
185
185
let key_path = PathBuf :: from ( signing_key) ;
186
- if key_path. is_file ( ) {
187
- Ok ( key_path)
188
- } else if signing_key. starts_with ( "ssh-" ) {
186
+ if signing_key. starts_with ( "ssh-" ) {
189
187
use std:: io:: Write ;
190
188
use tempfile:: NamedTempFile ;
191
189
let mut temp_file =
@@ -200,9 +198,7 @@ impl SignBuilder {
200
198
} ) ?;
201
199
Ok ( temp_file. 1 )
202
200
} else {
203
- Err ( SignBuilderError :: SSHSigningKey ( String :: from (
204
- "ssh key could not been resolved. Either the key is not a file or the key is not a valid public ssh key" ,
205
- ) ) )
201
+ Ok ( key_path)
206
202
}
207
203
}
208
204
}
@@ -306,6 +302,10 @@ impl Sign for SSHSign {
306
302
. arg ( "-f" )
307
303
. arg ( & self . signing_key ) ;
308
304
305
+ if & self . program == "ssh-keygen" {
306
+ cmd. arg ( "-P" ) . arg ( "\" \" " ) ;
307
+ }
308
+
309
309
log:: trace!( "signing command: {cmd:?}" ) ;
310
310
311
311
let mut child = cmd
@@ -319,6 +319,8 @@ impl Sign for SSHSign {
319
319
. map_err ( |e| SignError :: WriteBuffer ( e. to_string ( ) ) ) ?;
320
320
drop ( stdin) ;
321
321
322
+ //hllo
323
+
322
324
let output = child
323
325
. wait_with_output ( )
324
326
. map_err ( |e| SignError :: Output ( e. to_string ( ) ) ) ?;
@@ -332,11 +334,15 @@ impl Sign for SSHSign {
332
334
}
333
335
334
336
if !output. status . success ( ) {
337
+ let error_msg = std:: str:: from_utf8 ( & output. stderr )
338
+ . unwrap_or ( "[error could not be read from stderr]" ) ;
339
+ if error_msg. contains ( "passphrase" ) {
340
+ return Err ( SignError :: Shellout ( String :: from ( "Currently, we only support unencrypted pairs of ssh keys in disk or ssh-agents" ) ) ) ;
341
+ }
335
342
return Err ( SignError :: Shellout ( format ! (
336
343
"failed to sign data, program '{}' exited non-zero: {}" ,
337
344
& self . program,
338
- std:: str :: from_utf8( & output. stderr)
339
- . unwrap_or( "[error could not be read from stderr]" )
345
+ error_msg
340
346
) ) ) ;
341
347
}
342
348
0 commit comments