gabi

package module
v0.0.0-...-0abd600 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: BSD-3-Clause Imports: 16 Imported by: 3

README

Gabi   Go Reference Go Report Card

gabi is a Go implementation of the IRMA approach to the Idemix attribute based credential system. Check out the Privacy by Design Foundation website to learn more on this great alternative to traditional identity management.

gabi is the authoritative IRMA Idemix implementation, but it is still largely compatible with the now deprecated Java implementation.

gabi serves as the cryptographic core of irmago, which implements the IRMA server, IRMA app core, shared functionality between the two, and more. Most projects wanting to use IRMA or Idemix will want to use irmago instead of depending on gabi directly.

Install

To install:

go get github.com/AVecsi/pq-gabi

Test

To run tests:

go test -v ./... 

History

gabi was originally created and developed by Maarten Everts in 2015 and 2016. Since 2017, the Privacy by Design Foundation and SIDN maintain and develop gabi.

Documentation

Overview

Package gabi is an implementation of the IRMA (https://irma.app) approach to attribute based credentials. For now, see gabi_test.go on how to use the library.

Index

Constants

View Source
const BETA = 80 //TAU * ETA
View Source
const COMMITMENT_LENGTH = 12
View Source
const CSIZE = 12 // number of field elements to use for c tilde
View Source
const MUSIZE = 24
View Source
const NONCE_LENGTH = 12
View Source
const NumOfIterations = 100
View Source
const POS_CYCLE_LEN = 8
View Source
const POS_RATE = 24
View Source
const POS_RF = 21 // full rounds of Poseidon
View Source
const POS_T = 35
View Source
const TAU = 40

Variables

View Source
var Logger *logrus.Logger

Functions

func BuildMerkleTree

func BuildMerkleTree(attributes []*Attribute) (*merkletree.MerkleTree, error)

func GenerateNonce

func GenerateNonce() (*big.Int, error)

GenerateNonce generates a nonce for use in proofs

func GenerateSecretAttribute

func GenerateSecretAttribute() (*big.Int, error)

GenerateSecretAttribute generates secret attribute used prove ownership and links between credentials from the same user.

func HashStrategy

func HashStrategy() hash.Hash

func SampleInBall

func SampleInBall(h *poseidon.Poseidon) *algebra.Poly

func Test

func Test()

Types

type Attribute

type Attribute struct {
	Value []byte `json:"value"`
	Hash  []byte `json:"hash"`
}

Attribute implements the Content interface provided by merkletree and represents the content stored in the tree.

func NewAttribute

func NewAttribute(value []byte) (*Attribute, error)

func (Attribute) CalculateHash

func (t Attribute) CalculateHash() ([]byte, error)

CalculateHash hashes the values of a Attribute

func (Attribute) Equals

func (t Attribute) Equals(other merkletree.Content) (bool, error)

Equals tests for equality of two Attributes

func (Attribute) IntValue

func (t Attribute) IntValue() *big.Int

type Credential

type Credential struct {
	Signature     *ZkDilSignature `json:"signature"`
	Attributes    []*Attribute    `json:"attributes"`
	UserAttrCount int             `json:"userAttrCount"`
	AttrHash      []byte          `json:"attrHash"`
}

type CredentialDisclosure

type CredentialDisclosure struct {
	DisclosedAttributes       []*Attribute
	DisclosedAttributeIndices []int
	NumOfAllAttributes        int
	NumOfUserAttributes       int
	SignatureProof            *SignatureProof
}

func CreateCredentialDisclosure

func CreateCredentialDisclosure(credential *Credential, disclosedAttributeIndices []int) *CredentialDisclosure

type DisclosureProof

type DisclosureProof struct {
	AttrProof             []byte
	CredentialDisclosures []*CredentialDisclosure
}

func CreateDisclosureProof

func CreateDisclosureProof(credentials []*Credential, credentialDisclosures []*CredentialDisclosure) (*DisclosureProof, error)

func (*DisclosureProof) Verify

func (proof *DisclosureProof) Verify() bool

func (*DisclosureProof) VerifyWithoutSignature

func (proof *DisclosureProof) VerifyWithoutSignature() bool

type Issuer

type Issuer struct {
	Sk      *gabikeys.PrivateKey
	Pk      *gabikeys.PublicKey
	Context *big.Int
}

Issuer holds the key material for a credential issuer.

func NewIssuer

func NewIssuer(sk *gabikeys.PrivateKey, pk *gabikeys.PublicKey, context *big.Int) *Issuer

NewIssuer creates a new credential issuer.

func (*Issuer) IssueSignature

func (i *Issuer) IssueSignature(U *big.Int, attributes []*Attribute) (*ZkDilSignature, []byte, error)

IssueSignature produces an IssueSignatureMessage for the attributes based on the IssueCommitmentMessage provided. Note that this function DOES NOT check the proofs containted in the IssueCommitmentMessage! That needs to be done at a higher level!

type RandomCommitment

type RandomCommitment struct {
	Comm  []uint32
	Nonce []uint32
}

func NewRandomCommitment

func NewRandomCommitment(fieldElements []int, nonce []int) (*RandomCommitment, error)

type SignatureProof

type SignatureProof struct {
	Proof              []byte
	AttrHashCommitment *RandomCommitment
}

func (*SignatureProof) Verify

func (proof *SignatureProof) Verify() bool

type ZkDilSignature

type ZkDilSignature struct {
	Pk     *gabikeys.PublicKey `json:"pk"`
	CTilde []int               `json:"ctilde"`
	Z      *algebra.Vec        `json:"z"`
}

func Sign

func Sign(pubK *gabikeys.PublicKey, privK *gabikeys.PrivateKey, msg []byte) ZkDilSignature

func (*ZkDilSignature) Verify

func (sig *ZkDilSignature) Verify(msg []byte) bool

Directories

Path Synopsis
Package big contains a mostly API-compatible "math/big".Int that JSON-marshals to and from Base64.
Package big contains a mostly API-compatible "math/big".Int that JSON-marshals to and from Base64.
internal
In the literature the agent that is able to revoke (using a PrivateKey) is usually called the "revocation authority", which generally need not be the same agent as the issuer.
In the literature the agent that is able to revoke (using a PrivateKey) is usually called the "revocation authority", which generally need not be the same agent as the issuer.
Package safeprime computes safe primes, i.e.
Package safeprime computes safe primes, i.e.
Package signed contains (1) convenience functions for ECDSA private and public key handling, and for signing and verifying byte slices with ECDSA; (2) functions for marshaling structs to signed bytes, and verifying and unmarshaling signed bytes back to structs.
Package signed contains (1) convenience functions for ECDSA private and public key handling, and for signing and verifying byte slices with ECDSA; (2) functions for marshaling structs to signed bytes, and verifying and unmarshaling signed bytes back to structs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL