@@ -183,9 +183,7 @@ impl SignBuilder {
183183		signing_key :  & str , 
184184	)  -> Result < PathBuf ,  SignBuilderError >  { 
185185		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-" )  { 
189187			use  std:: io:: Write ; 
190188			use  tempfile:: NamedTempFile ; 
191189			let  mut  temp_file =
@@ -200,9 +198,7 @@ impl SignBuilder {
200198			} ) ?; 
201199			Ok ( temp_file. 1 ) 
202200		}  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) 
206202		} 
207203	} 
208204} 
@@ -306,6 +302,10 @@ impl Sign for SSHSign {
306302			. arg ( "-f" ) 
307303			. arg ( & self . signing_key ) ; 
308304
305+ 		if  & self . program  == "ssh-keygen"  { 
306+ 			cmd. arg ( "-P" ) . arg ( "\" \" " ) ; 
307+ 		} 
308+ 
309309		log:: trace!( "signing command: {cmd:?}" ) ; 
310310
311311		let  mut  child = cmd
@@ -319,6 +319,8 @@ impl Sign for SSHSign {
319319			. map_err ( |e| SignError :: WriteBuffer ( e. to_string ( ) ) ) ?; 
320320		drop ( stdin) ; 
321321
322+ 		//hllo 
323+ 
322324		let  output = child
323325			. wait_with_output ( ) 
324326			. map_err ( |e| SignError :: Output ( e. to_string ( ) ) ) ?; 
@@ -332,11 +334,15 @@ impl Sign for SSHSign {
332334		} 
333335
334336		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+ 			} 
335342			return  Err ( SignError :: Shellout ( format ! ( 
336343				"failed to sign data, program '{}' exited non-zero: {}" , 
337344				& self . program, 
338- 				std:: str :: from_utf8( & output. stderr) 
339- 				    . unwrap_or( "[error could not be read from stderr]" ) 
345+ 				error_msg
340346			) ) ) ; 
341347		} 
342348
0 commit comments