Documentation ¶
Overview ¶
Package compatibility implements wrapper types, constants and functions around github.com/emmyzkp/emmy/client, making relevant functionality compatible with go language binding tools. All the constructs defined in this package are compatible with gobind tool that generates language bindings for Java or Objective C in order to expose Go code to Android or iOS mobile applications.
The gobind tool imposes several restrictions on the types of exported fields, function parameters and their return values. Read more about them here: https://godoc.org/golang.org/x/mobile/cmd/gobind.
Only Java bindings generated from this package were tested.
Generating language bindings ¶
To generate Java bindings for use in an Android application, read the overview of gomobile tool (https://godoc.org/golang.org/x/mobile/cmd/gomobile). When you are all set, run:
gomobile bind -v -o emmy.aar github.com/emmyzkp/emmy/client/compatibility
This command will produce an Android archive (. AAR) named emmy.aar from compatibility package. You can add generated AAR as a dependency to your Android application. Then, you can import Go types, functions and constants as regular Java types from the Java package compatibility. For instance, see Java code snippet below:
import compatibility.Connetion; import compatibility.ConnectionConfig; ... ConnectionConfig cfg = new ConnectionConfig("localhost:7007", "", cert.getBytes()); Connection conn = new Connection(cfg)
Go types exposed to Java code ¶
Generic types:
ConnectionConfig Connection Logger ServiceInfo
Clients that allow us to execute various interactive cryptographic protocols with the server:
PseudonymsysCAClient PseudonymsysClient PseudonymsysCAECClient PseudonymsysECClient
Cryptographic types:
CACertificate CACertificateEC Credential CredentialEC ECGroupElement CLPubKey PubKeyEC Transcript TranscriptEC Pseudonym PseudonymEC
Index ¶
- Constants
- Variables
- func SetLogger(logger *Logger)
- type CACertificate
- type CACertificateEC
- type CLClient
- type CLCred
- type CLCredManager
- type CLCredManagerContext
- type CLLongAttribute
- type CLParams
- type CLPubKey
- type CLPublicParams
- type CLRawCred
- type CLRevealedAttrs
- type CLStringAttribute
- type Commitment
- type Connection
- type ConnectionConfig
- type Credential
- type CredentialEC
- type ECGroupElement
- type Logger
- type PedersenParams
- type Pseudonym
- type PseudonymEC
- type PseudonymsysCAClient
- type PseudonymsysCAClientEC
- type PseudonymsysClient
- func (c *PseudonymsysClient) GenerateMasterKey() string
- func (c *PseudonymsysClient) GenerateNym(userSecret string, cert *CACertificate, regKey string) (*Pseudonym, error)
- func (c *PseudonymsysClient) ObtainCredential(userSecret string, nym *Pseudonym, publicKey *PubKey) (*Credential, error)
- func (c *PseudonymsysClient) TransferCredential(orgName, userSecret string, nym *Pseudonym, cred *Credential) (string, error)
- type PseudonymsysClientEC
- func (c *PseudonymsysClientEC) GenerateMasterKey() string
- func (c *PseudonymsysClientEC) GenerateNym(userSecret string, cert *CACertificateEC, regKey string) (*PseudonymEC, error)
- func (c *PseudonymsysClientEC) ObtainCredential(userSecret string, nym *PseudonymEC, publicKey *PubKeyEC) (*CredentialEC, error)
- func (c *PseudonymsysClientEC) TransferCredential(orgName, userSecret string, nym *PseudonymEC, cred *CredentialEC) (string, error)
- type PubKey
- type PubKeyEC
- type SchnorrGroup
- type ServiceInfo
- type Transcript
- type TranscriptEC
Constants ¶
const ( DEBUG = log.DEBUG INFO = log.INFO NOTICE = log.NOTICE WARNING = log.WARNING ERROR = log.ERROR CRITICAL = log.CRITICAL )
Supported log levels.
const ( P256 = int(ec.P256) P224 = int(ec.P224) P384 = int(ec.P384) P521 = int(ec.P521) )
Representations of specific elliptic curves to be used in elliptic cryptography based schemes.
Variables ¶
var ArgsConversionError = errors.New("failed to convert string argument to big integer")
ArgsConversionError indicates an error due to a failed conversion of string argument to *big.Int type from package https://golang.org/pkg/math/big/.
Functions ¶
Types ¶
type CACertificate ¶
CACertificate represents an equivalent of pseudsys.CACert, but has string field types to overcome type restrictions of Go language binding tools.
func NewCACertificate ¶
func NewCACertificate(blindedA, blindedB, r, s string) *CACertificate
type CACertificateEC ¶
type CACertificateEC struct { BlindedA *ECGroupElement BlindedB *ECGroupElement R string S string }
CACertificateEC represents an equivalent of pseudonymsys.CACertificateEC, but has field types compatible with Go language binding tools.
func NewCACertificateEC ¶
func NewCACertificateEC(bA, bB *ECGroupElement, r, s string) *CACertificateEC
type CLClient ¶
func NewCLClient ¶
func NewCLClient(conn *Connection) *CLClient
func (*CLClient) GetPublicParams ¶
func (c *CLClient) GetPublicParams() (*CLPublicParams, error)
func (*CLClient) IssueCred ¶
func (c *CLClient) IssueCred(cm *CLCredManager, regKey string) (*CLCred, error)
func (*CLClient) ProveCred ¶
func (c *CLClient) ProveCred(cm *CLCredManager, cred *CLCred, revealed *CLRevealedAttrs) (string, error)
type CLCredManager ¶
type CLCredManager struct {
*cl.CredManager
}
func NewCLCredManager ¶
func NewCLCredManager(params *CLParams, pk *CLPubKey, secret []byte, cred *CLRawCred) (*CLCredManager, error)
NewCLCredManager generates credential manager for the CL scheme. It accepts parameters for the CL scheme (these must match server-side configuration), server's public key, user's secret and attributes to manage.
func RestoreCLCredManager ¶
func RestoreCLCredManager(ctx *CLCredManagerContext, secret []byte, cred *CLRawCred) (*CLCredManager, error)
RestoreCLCredManager establishes credential manager for the CL scheme. It is meant to be used to re-establish the credential manager after it has been previously created with NewCLCredManager.
func (*CLCredManager) GetContext ¶
func (cm *CLCredManager) GetContext() *CLCredManagerContext
GetContext returns a CLCredManagerContext filled with current state of the CLCredManager. It can be used to restore a CLCredManager.
type CLCredManagerContext ¶
type CLCredManagerContext struct {
*cl.CredManagerCtx
}
func NewCLCredManagerContext ¶
func NewCLCredManagerContext(bytes []byte) (*CLCredManagerContext, error)
func (*CLCredManagerContext) Bytes ¶
func (c *CLCredManagerContext) Bytes() ([]byte, error)
type CLLongAttribute ¶
type CLPubKey ¶
func (*CLPubKey) GenerateMasterSecret ¶
type CLPublicParams ¶
type CLRawCred ¶
type CLRawCred struct {
// contains filtered or unexported fields
}
func NewCLRawCred ¶
func (*CLRawCred) GetAttributeNames ¶
func (*CLRawCred) SetLongAttribute ¶
func (*CLRawCred) SetStringAttribute ¶
type CLRevealedAttrs ¶
type CLRevealedAttrs struct {
// contains filtered or unexported fields
}
func NewCLRevealedAttrs ¶
func NewCLRevealedAttrs() *CLRevealedAttrs
func (*CLRevealedAttrs) Add ¶
func (a *CLRevealedAttrs) Add(attr string)
type CLStringAttribute ¶
type Commitment ¶
type Commitment struct {
// contains filtered or unexported fields
}
type Connection ¶
type Connection struct {
*grpc.ClientConn
}
Connection wraps *grpc.ClientConn. A Connection should be constructed independently and then passed as an argument to protocol clients. Same Connection can be re-used for many clients.
func NewConnection ¶
func NewConnection(cfg *ConnectionConfig) (*Connection, error)
NewConnection accepts *ConnectionConfig and uses the provided configuration information to establish connection to the server.
func (*Connection) Close ¶
func (c *Connection) Close() error
Close attempts to close connection to the server.
type ConnectionConfig ¶
type ConnectionConfig struct { Endpoint string // Server's Endpoint ServerNameOverride string CACertificate []byte TimeoutMillis int }
ConnectionConfig wraps client.ConnectionConfig that holds connection information. Clients need to provide these information in order to establish connection to the server. For more details see documentation for the github.com/emmyzkp/emmy/client package.
func NewConnectionConfig ¶
func NewConnectionConfig(endpoint, serverNameOverride string, certificate []byte, timeout int) *ConnectionConfig
NewConnectionConfig constructs an instance of ConnectionConfig based on the provided server endpoint, serverNameOverride and CA certificate.
type Credential ¶
type Credential struct { SmallAToGamma string SmallBToGamma string AToGamma string BToGamma string T1 *Transcript T2 *Transcript }
Credential represents an equivalent of pseudsys.CLCred, but has field types compatible with Go language binding tools.
func NewCredential ¶
func NewCredential(aToGamma, bToGamma, AToGamma, BToGamma string, t1, t2 *Transcript) *Credential
type CredentialEC ¶
type CredentialEC struct { SmallAToGamma *ECGroupElement SmallBToGamma *ECGroupElement AToGamma *ECGroupElement BToGamma *ECGroupElement T1 *TranscriptEC T2 *TranscriptEC }
CredentialEC represents an equivalent of ecpseudsys.CLCred, but has field types compatible with Go language binding tools.
func NewCredentialEC ¶
func NewCredentialEC(aToGamma, bToGamma, AToGamma, BToGamma *ECGroupElement, t1, t2 *TranscriptEC) *CredentialEC
type ECGroupElement ¶
ECGroupElement represents an equivalent of ec.GroupElement, but has string field types to overcome type restrictions of Go language binding tools.
func NewECGroupElement ¶
func NewECGroupElement(x, y string) *ECGroupElement
type Logger ¶
type Logger struct {
*log.StdoutLogger
}
Logger wraps a concrete *log.StdoutLogger implementation. It can be constructed by the client application in order to override default logger provided by the client package.
type PedersenParams ¶
type PedersenParams struct { Group SchnorrGroup H []byte // contains filtered or unexported fields }
type Pseudonym ¶
Pseudonym represents an equivalent of pseudsys.Nym, but has string field types to overcome type restrictions of Go language binding tools.
func NewPseudonym ¶
type PseudonymEC ¶
type PseudonymEC struct { A *ECGroupElement B *ECGroupElement }
PseudonymEC represents an equivalent of pseudonymsys.PseudonymEC, but has field types compatible with Go language binding tools.
func NewPseudonymEC ¶
func NewPseudonymEC(a, b *ECGroupElement) *PseudonymEC
type PseudonymsysCAClient ¶
CAClient wraps around client.CAClient to conform to type restrictions of Go language binding tools. It exposes the same set of methods as client.CAClient.
func NewPseudonymsysCAClient ¶
func NewPseudonymsysCAClient(g *SchnorrGroup) (*PseudonymsysCAClient, error)
func (*PseudonymsysCAClient) Connect ¶
func (c *PseudonymsysCAClient) Connect(conn *Connection)
func (*PseudonymsysCAClient) GenerateCertificate ¶
func (c *PseudonymsysCAClient) GenerateCertificate(userSecret string, nym *Pseudonym) (*CACertificate, error)
func (*PseudonymsysCAClient) GenerateMasterNym ¶
func (c *PseudonymsysCAClient) GenerateMasterNym(secret string) (*Pseudonym, error)
type PseudonymsysCAClientEC ¶
PseudonymsysCAECClient wraps around client.CAClient to conform to type restrictions of Go language binding tools. It exposes the same set of methods as client.CAClient.
func NewPseudonymsysCAClientEC ¶
func NewPseudonymsysCAClientEC(curve int) *PseudonymsysCAClientEC
func (*PseudonymsysCAClientEC) Connect ¶
func (c *PseudonymsysCAClientEC) Connect(conn *Connection)
func (*PseudonymsysCAClientEC) GenerateCertificate ¶
func (c *PseudonymsysCAClientEC) GenerateCertificate(userSecret string, nym *PseudonymEC) (*CACertificateEC, error)
func (*PseudonymsysCAClientEC) GenerateMasterNym ¶
func (c *PseudonymsysCAClientEC) GenerateMasterNym(secret string, curve int) (*PseudonymEC, error)
type PseudonymsysClient ¶
CLClient wraps around client.CLClient to conform to type restrictions of Go language binding tools. It exposes the same set of methods as client.CLClient.
func NewPseudonymsysClient ¶
func NewPseudonymsysClient(conn *Connection, g *SchnorrGroup) (*PseudonymsysClient, error)
func (*PseudonymsysClient) GenerateMasterKey ¶
func (c *PseudonymsysClient) GenerateMasterKey() string
GenerateMasterKey returns a string representation of the master secret key to be used with the pseudonym system scheme.
func (*PseudonymsysClient) GenerateNym ¶
func (c *PseudonymsysClient) GenerateNym(userSecret string, cert *CACertificate, regKey string) (*Pseudonym, error)
func (*PseudonymsysClient) ObtainCredential ¶
func (c *PseudonymsysClient) ObtainCredential(userSecret string, nym *Pseudonym, publicKey *PubKey) (*Credential, error)
func (*PseudonymsysClient) TransferCredential ¶
func (c *PseudonymsysClient) TransferCredential(orgName, userSecret string, nym *Pseudonym, cred *Credential) (string, error)
type PseudonymsysClientEC ¶
CLClient wraps around client.CLClient to conform to type restrictions of Go language binding tools. It exposes the same set of methods as client.CLClient.
func NewPseudonymsysClientEC ¶
func NewPseudonymsysClientEC(conn *Connection, curve int) (*PseudonymsysClientEC, error)
func (*PseudonymsysClientEC) GenerateMasterKey ¶
func (c *PseudonymsysClientEC) GenerateMasterKey() string
GenerateMasterKey returns a string representation of the master secret key to be used with the pseudonym system scheme in the EC arithmetic.
func (*PseudonymsysClientEC) GenerateNym ¶
func (c *PseudonymsysClientEC) GenerateNym(userSecret string, cert *CACertificateEC, regKey string) (*PseudonymEC, error)
func (*PseudonymsysClientEC) ObtainCredential ¶
func (c *PseudonymsysClientEC) ObtainCredential(userSecret string, nym *PseudonymEC, publicKey *PubKeyEC) (*CredentialEC, error)
func (*PseudonymsysClientEC) TransferCredential ¶
func (c *PseudonymsysClientEC) TransferCredential(orgName, userSecret string, nym *PseudonymEC, cred *CredentialEC) (string, error)
type PubKey ¶
CLPubKey represents an equivalent of pseudsys.CLPubKey, but has string field types to overcome type restrictions of Go language binding tools.
type PubKeyEC ¶
type PubKeyEC struct { H1 *ECGroupElement H2 *ECGroupElement }
PubKeyEC represents an equivalent of ecpseudsys.PubKeyEC, but has field types compatible with Go language binding tools.
func NewPubKeyEC ¶
func NewPubKeyEC(h1, h2 *ECGroupElement) *PubKeyEC
type SchnorrGroup ¶
SchnorrGroup represents an equivalent of schnorr.Group, but has string field types to overcome type restrictions of Go language binding tools.
func NewSchnorrGroup ¶
func NewSchnorrGroup(p, g, q string) *SchnorrGroup
type ServiceInfo ¶
ServiceInfo holds information about the secure service provider and its service offering.
type Transcript ¶
Transcript represents an equivalent of schnorr.BlindedTrans, but has string field types to overcome type restrictions of Go language binding tools.
func NewTranscript ¶
func NewTranscript(a, b, hash, zAlpha string) *Transcript
type TranscriptEC ¶
type TranscriptEC struct { Alpha_1 string Alpha_2 string Beta_1 string Beta_2 string Hash string ZAlpha string }
TranscriptEC represents an equivalent of ecschnorr.BlindedTrans, but has string field types to overcome type restrictions of Go language binding tools.
func NewTranscriptEC ¶
func NewTranscriptEC(alpha_1, alpha_2, beta_1, beta_2, hash, zAlpha string) *TranscriptEC