github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/x509/certinfo_test.go (about)

     1  package x509_test
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/hxx258456/ccgo/x509"
     8  )
     9  
    10  func TestCertinfo(t *testing.T) {
    11  	certPath := "testdata/sm2_sign_cert.cer"
    12  
    13  	cert, _ := x509.ReadCertificateFromPemFile(certPath)
    14  
    15  	certText, err := x509.CertificateText(cert)
    16  	if err != nil {
    17  		t.Fatal(err)
    18  	}
    19  	fmt.Println(certText)
    20  }