Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateKeyPair(param *SystemParameters, numAttributes int, counter uint, expiryDate time.Time) (*PrivateKey, *PublicKey, error)
- func GenerateRevocationKeypair(privk *PrivateKey, pubk *PublicKey) error
- type BaseParameters
- type Bases
- type DerivedParameters
- type EpochLength
- type PrivateKey
- type PublicKey
- func (pubk *PublicKey) Base(name string) *big.Int
- func (pubk *PublicKey) Exp(ret *big.Int, name string, exp, n *big.Int) bool
- func (pubk *PublicKey) Names() []string
- func (pubk *PublicKey) Print() error
- func (pubk *PublicKey) RevocationSupported() bool
- func (pubk *PublicKey) WriteTo(writer io.Writer) (int64, error)
- func (pubk *PublicKey) WriteToFile(filename string, forceOverwrite bool) (int64, error)
- type SystemParameters
Constants ¶
const ( //XMLHeader can be a used as the XML header when writing keys in XML format. XMLHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" // DefaultEpochLength is the default epoch length for public keys. DefaultEpochLength = 432000 )
Variables ¶
var ( // DefaultSystemParameters holds per key length the default parameters as are // currently in use at the moment. This might (and probably will) change in the // future. DefaultSystemParameters = map[int]*SystemParameters{ 1024: {defaultBaseParameters[1024], MakeDerivedParameters(defaultBaseParameters[1024])}, 2048: {defaultBaseParameters[2048], MakeDerivedParameters(defaultBaseParameters[2048])}, 4096: {defaultBaseParameters[4096], MakeDerivedParameters(defaultBaseParameters[4096])}, } // DefaultKeyLengths is a slice of integers holding the key lengths for which // system parameters are available. DefaultKeyLengths = getAvailableKeyLengths(DefaultSystemParameters) )
defaultBaseParameters holds per key length the base parameters.
Functions ¶
func GenerateKeyPair ¶
func GenerateKeyPair(param *SystemParameters, numAttributes int, counter uint, expiryDate time.Time) (*PrivateKey, *PublicKey, error)
GenerateKeyPair generates a private/public keypair for an Issuer
func GenerateRevocationKeypair ¶
func GenerateRevocationKeypair(privk *PrivateKey, pubk *PublicKey) error
Types ¶
type BaseParameters ¶
BaseParameters holds the base system parameters
type Bases ¶
func (*Bases) MarshalXML ¶
MarshalXML is an internal function to simplify encoding a PublicKey to XML.
func (*Bases) UnmarshalXML ¶
UnmarshalXML is an internal function to simplify decoding a PublicKey from XML.
type DerivedParameters ¶
type DerivedParameters struct { Le uint LeCommit uint LmCommit uint LRA uint LsCommit uint Lv uint LvCommit uint LvPrime uint LvPrimeCommit uint }
DerivedParameters holds system parameters that can be derived from base system parameters (BaseParameters)
func MakeDerivedParameters ¶
func MakeDerivedParameters(base BaseParameters) DerivedParameters
MakeDerivedParameters computes the derived system parameters
type EpochLength ¶
type EpochLength int
func (*EpochLength) MarshalXML ¶
func (el *EpochLength) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML is an internal function to simplify encoding a PublicKey to XML.
func (*EpochLength) UnmarshalXML ¶
func (el *EpochLength) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML is an internal function to simplify decoding a PublicKey from XML.
type PrivateKey ¶
type PrivateKey struct { XMLName xml.Name `xml:"http://www.zurich.ibm.com/security/idemix IssuerPrivateKey"` Counter uint `xml:"Counter"` ExpiryDate int64 `xml:"ExpiryDate"` P *big.Int `xml:"Elements>p"` Q *big.Int `xml:"Elements>q"` PPrime *big.Int `xml:"Elements>pPrime"` QPrime *big.Int `xml:"Elements>qPrime"` ECDSAString string `xml:"ECDSA,omitempty"` N *big.Int `xml:"-"` ECDSA *ecdsa.PrivateKey `xml:"-"` Order *big.Int `xml:"-"` }
PrivateKey represents an issuer's private key.
func NewPrivateKey ¶
func NewPrivateKey(p, q *big.Int, ecdsa string, counter uint, expiryDate time.Time) (*PrivateKey, error)
NewPrivateKey creates a new issuer private key using the provided parameters.
func NewPrivateKeyFromFile ¶
func NewPrivateKeyFromFile(filename string, demo bool) (*PrivateKey, error)
NewPrivateKeyFromFile creates a new issuer private key from an XML file.
func NewPrivateKeyFromXML ¶
func NewPrivateKeyFromXML(xmlInput string, demo bool) (*PrivateKey, error)
NewPrivateKeyFromXML creates a new issuer private key using the XML data provided.
func (*PrivateKey) RevocationSupported ¶
func (privk *PrivateKey) RevocationSupported() bool
func (*PrivateKey) Validate ¶
func (privk *PrivateKey) Validate() error
func (*PrivateKey) WriteTo ¶
func (privk *PrivateKey) WriteTo(writer io.Writer) (int64, error)
WriteTo writes the XML-serialized public key to the given writer.
func (*PrivateKey) WriteToFile ¶
func (privk *PrivateKey) WriteToFile(filename string, forceOverwrite bool) (int64, error)
WriteToFile writes the private key to an XML file. If any existing file with the same filename should be overwritten, set forceOverwrite to true.
type PublicKey ¶
type PublicKey struct { XMLName xml.Name `xml:"http://www.zurich.ibm.com/security/idemix IssuerPublicKey"` Counter uint `xml:"Counter"` ExpiryDate int64 `xml:"ExpiryDate"` N *big.Int `xml:"Elements>n"` // Modulus n Z *big.Int `xml:"Elements>Z"` // Generator Z S *big.Int `xml:"Elements>S"` // Generator S G *big.Int `xml:"Elements>G"` // Generator G for revocation H *big.Int `xml:"Elements>H"` // Generator H for revocation R Bases `xml:"Elements>Bases"` EpochLength EpochLength `xml:"Features"` ECDSAString string `xml:"ECDSA,omitempty"` ECDSA *ecdsa.PublicKey `xml:"-"` Params *SystemParameters `xml:"-"` Issuer string `xml:"-"` }
PublicKey represents an issuer's public key.
func NewPublicKey ¶
func NewPublicKey(N, Z, S, G, H *big.Int, R []*big.Int, ecdsa string, counter uint, expiryDate time.Time) (*PublicKey, error)
NewPublicKey creates and returns a new public key based on the provided parameters.
func NewPublicKeyFromBytes ¶
NewPublicKeyFromBytes creates a new issuer public key using the XML data provided.
func NewPublicKeyFromFile ¶
NewPublicKeyFromFile creates a new issuer public key from an XML file.
func NewPublicKeyFromXML ¶
func (*PublicKey) RevocationSupported ¶
type SystemParameters ¶
type SystemParameters struct { BaseParameters DerivedParameters }
SystemParameters holds the system parameters of the IRMA system.