github.com/haraldrudell/parl@v0.4.176/parlca/rsa-private_test.go (about)

     1  /*
     2  © 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package parlca
     7  
     8  import (
     9  	"crypto/x509"
    10  	"testing"
    11  
    12  	"github.com/haraldrudell/parl"
    13  	"github.com/haraldrudell/parl/perrors"
    14  )
    15  
    16  func TestRsa(t *testing.T) {
    17  	var privateKey parl.PrivateKey
    18  	var err error
    19  	if privateKey, err = NewRsa(); err != nil {
    20  		t.Errorf("err NewRsa %s", perrors.Short(err))
    21  		t.FailNow()
    22  	}
    23  	if privateKey.Algo() != x509.RSA {
    24  		t.Errorf("bad algo %s exp %s", privateKey.Algo(), x509.RSA)
    25  	}
    26  
    27  	/*
    28  		var rsaPrivateKey *rsa.PrivateKey
    29  		// runtime error: invalid memory address or nil pointer dereference
    30  		if err = rsaPrivateKey.Validate(); err != nil {
    31  			t.Errorf("err Validate %s", perrors.Short(err))
    32  		}
    33  	*/
    34  }