github.com/haraldrudell/parl@v0.4.176/parlca/rsa-public_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 TestRsaPublicKey_Algo(t *testing.T) {
    17  	var privateKey parl.PrivateKey
    18  	var err error
    19  	if privateKey, err = NewRsa(); err != nil {
    20  		t.Errorf("NewRsa %s", perrors.Short(err))
    21  		t.FailNow()
    22  	}
    23  	publicKey := privateKey.PublicKey()
    24  	if publicKey.Algo() != x509.RSA {
    25  		t.Errorf("bad algo %s exp %s", publicKey.Algo(), x509.RSA)
    26  	}
    27  }