File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 "crypto/tls"
66 "crypto/x509"
77 "encoding/pem"
8+ "errors"
89 "fmt"
910 "net"
1011 "reflect"
@@ -164,6 +165,9 @@ func handshakeAction(c *cli.Context) error {
164165
165166 // Print only the list of verified chains
166167 if printChains {
168+ if len (cs .VerifiedChains ) == 0 {
169+ return errors .New ("failed to build a chain of verified certificates" )
170+ }
167171 for _ , chain := range cs .VerifiedChains {
168172 for _ , crt := range chain {
169173 fmt .Print (string (pem .EncodeToMemory (& pem.Block {
@@ -177,6 +181,9 @@ func handshakeAction(c *cli.Context) error {
177181
178182 // Print only the peer certificates
179183 if printPeer {
184+ if len (cs .PeerCertificates ) == 0 {
185+ return errors .New ("peer did not sent a certificate" )
186+ }
180187 for _ , crt := range cs .PeerCertificates {
181188 fmt .Print (string (pem .EncodeToMemory (& pem.Block {
182189 Type : "CERTIFICATE" , Bytes : crt .Raw ,
You can’t perform that action at this time.
0 commit comments