@@ -275,11 +275,12 @@ def test_selfsign_verify_fails_wrong_ca(self):
275275 """Self-signed cert should not verify with unrelated CAs."""
276276 out = "test_ca_selfsign_vf.pem"
277277 self ._clean (out )
278- run_wolfssl ("ca" , "-config" , self .conf ,
279- "-in" , self .csr , "-out" , out ,
280- "-md" , "sha256" , "-selfsign" ,
281- "-keyfile" ,
282- os .path .join (CERTS_DIR , "server-key.pem" ))
278+ r = run_wolfssl ("ca" , "-config" , self .conf ,
279+ "-in" , self .csr , "-out" , out ,
280+ "-md" , "sha256" , "-selfsign" ,
281+ "-keyfile" ,
282+ os .path .join (CERTS_DIR , "server-key.pem" ))
283+ self .assertEqual (r .returncode , 0 , r .stderr )
283284
284285 r1 = run_wolfssl ("verify" , "-CAfile" ,
285286 os .path .join (CERTS_DIR , "server-cert.pem" ), out )
@@ -486,8 +487,9 @@ def test_rand_file_written(self):
486487 """Rand file should be 256 bytes after cert creation."""
487488 out = "test_ca_rand.pem"
488489 self ._clean (out )
489- run_wolfssl ("ca" , "-config" , self .conf ,
490- "-in" , self .csr , "-out" , out )
490+ r = run_wolfssl ("ca" , "-config" , self .conf ,
491+ "-in" , self .csr , "-out" , out )
492+ self .assertEqual (r .returncode , 0 , r .stderr )
491493 self .assertTrue (os .path .isfile ("rand-file-test" ))
492494 size = os .path .getsize ("rand-file-test" )
493495 self .assertEqual (size , 256 ,
@@ -499,16 +501,18 @@ def test_rand_file_changes(self):
499501 out2 = "test_ca_randc2.pem"
500502 self ._clean (out1 , out2 )
501503
502- run_wolfssl ("ca" , "-config" , self .conf ,
503- "-in" , self .csr , "-out" , out1 )
504+ r = run_wolfssl ("ca" , "-config" , self .conf ,
505+ "-in" , self .csr , "-out" , out1 )
506+ self .assertEqual (r .returncode , 0 , r .stderr )
504507 with open ("rand-file-test" , "rb" ) as f :
505508 rand1 = f .read ()
506509
507510 _cleanup ("index.txt" )
508511 _touch ("index.txt" )
509512
510- run_wolfssl ("ca" , "-config" , self .conf ,
511- "-in" , self .csr , "-out" , out2 )
513+ r = run_wolfssl ("ca" , "-config" , self .conf ,
514+ "-in" , self .csr , "-out" , out2 )
515+ self .assertEqual (r .returncode , 0 , r .stderr )
512516 with open ("rand-file-test" , "rb" ) as f :
513517 rand2 = f .read ()
514518
@@ -548,10 +552,11 @@ def test_no_common_name_supplied_fails(self):
548552 csr = "ca_pol_nocn.csr"
549553 out = "ca_pol_nocn.pem"
550554 self ._clean (csr , out )
551- run_wolfssl ("req" , "-key" ,
552- os .path .join (CERTS_DIR , "server-key.pem" ),
553- "-subj" , "O=wolfSSL/C=US/ST=MT/L=Bozeman/OU=org-unit" ,
554- "-out" , csr )
555+ r = run_wolfssl ("req" , "-key" ,
556+ os .path .join (CERTS_DIR , "server-key.pem" ),
557+ "-subj" , "O=wolfSSL/C=US/ST=MT/L=Bozeman/OU=org-unit" ,
558+ "-out" , csr )
559+ self .assertEqual (r .returncode , 0 , r .stderr )
555560 r = run_wolfssl ("ca" , "-config" , self .conf ,
556561 "-in" , csr , "-out" , out ,
557562 "-md" , "sha256" ,
@@ -563,10 +568,11 @@ def test_no_common_name_match_fails(self):
563568 csr = "ca_pol_nocnm.csr"
564569 out = "ca_pol_nocnm.pem"
565570 self ._clean (csr , out )
566- run_wolfssl ("req" , "-key" ,
567- os .path .join (CERTS_DIR , "server-key.pem" ),
568- "-subj" , "O=wolfSSL/C=US/ST=MT/L=Bozeman/OU=org-unit" ,
569- "-out" , csr )
571+ r = run_wolfssl ("req" , "-key" ,
572+ os .path .join (CERTS_DIR , "server-key.pem" ),
573+ "-subj" , "O=wolfSSL/C=US/ST=MT/L=Bozeman/OU=org-unit" ,
574+ "-out" , csr )
575+ self .assertEqual (r .returncode , 0 , r .stderr )
570576 r = run_wolfssl ("ca" , "-config" , self .match_conf ,
571577 "-in" , csr , "-out" , out ,
572578 "-md" , "sha256" ,
@@ -578,11 +584,12 @@ def test_common_name_supplied_succeeds(self):
578584 csr = "ca_pol_cn.csr"
579585 out = "ca_pol_cn.pem"
580586 self ._clean (csr , out )
581- run_wolfssl ("req" , "-key" ,
582- os .path .join (CERTS_DIR , "server-key.pem" ),
583- "-subj" ,
584- "O=Sawtooth/CN=www.wolfclu.com/C=US/ST=MT/L=Bozeman/OU=org-unit" ,
585- "-out" , csr )
587+ r = run_wolfssl ("req" , "-key" ,
588+ os .path .join (CERTS_DIR , "server-key.pem" ),
589+ "-subj" ,
590+ "O=Sawtooth/CN=www.wolfclu.com/C=US/ST=MT/L=Bozeman/OU=org-unit" ,
591+ "-out" , csr )
592+ self .assertEqual (r .returncode , 0 , r .stderr )
586593 r = run_wolfssl ("ca" , "-config" , self .conf ,
587594 "-in" , csr , "-out" , out ,
588595 "-md" , "sha256" ,
@@ -594,11 +601,12 @@ def test_common_name_mismatch_fails(self):
594601 csr = "ca_pol_cnmm.csr"
595602 out = "ca_pol_cnmm.pem"
596603 self ._clean (csr , out )
597- run_wolfssl ("req" , "-key" ,
598- os .path .join (CERTS_DIR , "server-key.pem" ),
599- "-subj" ,
600- "O=Sawtooth/CN=www.wolfclu.com/C=US/ST=MT/L=Bozeman/OU=org-unit" ,
601- "-out" , csr )
604+ r = run_wolfssl ("req" , "-key" ,
605+ os .path .join (CERTS_DIR , "server-key.pem" ),
606+ "-subj" ,
607+ "O=Sawtooth/CN=www.wolfclu.com/C=US/ST=MT/L=Bozeman/OU=org-unit" ,
608+ "-out" , csr )
609+ self .assertEqual (r .returncode , 0 , r .stderr )
602610 r = run_wolfssl ("ca" , "-config" , self .match_conf ,
603611 "-in" , csr , "-out" , out ,
604612 "-md" , "sha256" ,
0 commit comments