github.com/ronperry/cryptoedge@v0.0.0-20150815114006-cc363e290743/jcc/interface_test.go (about)

     1  package jcc
     2  
     3  import (
     4  	"crypto/elliptic"
     5  	"crypto/rand"
     6  	"github.com/ronperry/cryptoedge/eccutil"
     7  	"github.com/ronperry/cryptoedge/genericblinding"
     8  	"testing"
     9  )
    10  
    11  func GetParams(blindingServer genericblinding.BlindingServer) (genericblinding.BlindingParamClient, genericblinding.BlindingParamServer, error) {
    12  	bpc, bps, err := blindingServer.GetParams()
    13  	return bpc.(BlindingParamClient), bps.(BlindingParamServer), err
    14  }
    15  
    16  func Test_Interface(t *testing.T) {
    17  	c := eccutil.SetCurve(elliptic.P256, rand.Reader, eccutil.Sha1Hash)
    18  	privkey, pubkey, err := c.GenerateKey()
    19  	if err != nil {
    20  		t.Fatalf("Error creating keys: %s", err)
    21  	}
    22  	signer := NewGenericBlindingServer(privkey, pubkey, c, Fakeunique)
    23  	clientParams, serverParams, err := GetParams(signer)
    24  	if err != nil {
    25  		t.Fatalf("Error GetParams: %s", err)
    26  	}
    27  	_, _ = clientParams, serverParams
    28  }
    29  
    30  // // does not implement wrong type for method