Documentation ¶
Overview ¶
Package compatibility implements wrapper types, constants and functions around github.com/xlab-si/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/xlab-si/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 PubKey PubKeyEC Transcript TranscriptEC Pseudonym PseudonymEC
Index ¶
- Constants
- Variables
- func SetLogger(logger *Logger)
- type CACertificate
- type CACertificateEC
- type Connection
- type ConnectionConfig
- type Credential
- type CredentialEC
- type ECGroupElement
- type Logger
- 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.ir/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 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 {
client.ConnectionConfig
}
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/xlab-si/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.Cred, 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.Cred, 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 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 ¶
type PseudonymsysCAClient struct {
*client.PseudonymsysCAClient
}
PseudonymsysCAClient wraps around client.PseudonymsysCAClient to conform to type restrictions of Go language binding tools. It exposes the same set of methods as client.PseudonymsysCAClient.
func NewPseudonymsysCAClient ¶
func NewPseudonymsysCAClient(conn *Connection, g *SchnorrGroup) (*PseudonymsysCAClient, error)
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 ¶
type PseudonymsysCAClientEC struct {
*client.PseudonymsysCAClientEC
}
PseudonymsysCAECClient wraps around client.PseudonymsysCAClientEC to conform to type restrictions of Go language binding tools. It exposes the same set of methods as client.PseudonymsysCAClientEC.
func NewPseudonymsysCAClientEC ¶
func NewPseudonymsysCAClientEC(conn *Connection, curve int) (*PseudonymsysCAClientEC, error)
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 ¶
type PseudonymsysClient struct {
*client.PseudonymsysClient
}
PseudonymsysClient wraps around client.PseudonymsysClient to conform to type restrictions of Go language binding tools. It exposes the same set of methods as client.PseudonymsysClient.
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 ¶
type PseudonymsysClientEC struct {
*client.PseudonymsysClientEC
}
PseudonymsysClientEC wraps around client.PseudonymsysClientEC to conform to type restrictions of Go language binding tools. It exposes the same set of methods as client.PseudonymsysClientEC.
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 ¶
PubKey represents an equivalent of pseudsys.PubKey, 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.
func GetServiceInfo ¶
func GetServiceInfo(conn *Connection) (*ServiceInfo, error)
GetServiceInfo contacts emmy server to retrieve basic information about its secure 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