Commit 7b612610 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Remove pointer from IrmaSignedMessage.Signature

parent 183c7256
...@@ -12,9 +12,8 @@ import ( ...@@ -12,9 +12,8 @@ import (
// IrmaSignedMessage is a message signed with an attribute-based signature // IrmaSignedMessage is a message signed with an attribute-based signature
// The 'realnonce' will be calculated as: SigRequest.GetNonce() = ASN1(sha256(message), sha256(nonce)) // The 'realnonce' will be calculated as: SigRequest.GetNonce() = ASN1(sha256(message), sha256(nonce))
// // TODO: remove pointer from Signature
type IrmaSignedMessage struct { type IrmaSignedMessage struct {
Signature *gabi.ProofList `json:"signature"` Signature gabi.ProofList `json:"signature"`
Nonce *big.Int `json:"nonce"` Nonce *big.Int `json:"nonce"`
Context *big.Int `json:"context"` Context *big.Int `json:"context"`
Message string `json:"message"` Message string `json:"message"`
......
...@@ -345,7 +345,7 @@ func (sr *SignatureRequest) SignatureFromMessage(message interface{}) (*IrmaSign ...@@ -345,7 +345,7 @@ func (sr *SignatureRequest) SignatureFromMessage(message interface{}) (*IrmaSign
} }
return &IrmaSignedMessage{ return &IrmaSignedMessage{
Signature: &signature, Signature: signature,
Nonce: sr.Nonce, Nonce: sr.Nonce,
Context: sr.Context, Context: sr.Context,
Message: sr.Message, Message: sr.Message,
......
...@@ -58,10 +58,10 @@ func VerifyTimestamp(irmaSignature *IrmaSignedMessage, message string, conf *Con ...@@ -58,10 +58,10 @@ func VerifyTimestamp(irmaSignature *IrmaSignedMessage, message string, conf *Con
// Extract the disclosed attributes and randomized CL-signatures from the proofs in order to // Extract the disclosed attributes and randomized CL-signatures from the proofs in order to
// construct the nonce that should be signed by the timestamp server. // construct the nonce that should be signed by the timestamp server.
zero := big.NewInt(0) zero := big.NewInt(0)
size := len(*irmaSignature.Signature) size := len(irmaSignature.Signature)
sigs := make([]*big.Int, size) sigs := make([]*big.Int, size)
disclosed := make([][]*big.Int, size) disclosed := make([][]*big.Int, size)
for i, proof := range *irmaSignature.Signature { for i, proof := range irmaSignature.Signature {
proofd := proof.(*gabi.ProofD) proofd := proof.(*gabi.ProofD)
meta := MetadataFromInt(proofd.ADisclosed[1], conf) meta := MetadataFromInt(proofd.ADisclosed[1], conf)
sigs[i] = proofd.A sigs[i] = proofd.A
......
...@@ -233,7 +233,7 @@ func addExtraAttributes(disclosed DisclosedCredentialList, proofResult *ProofRes ...@@ -233,7 +233,7 @@ func addExtraAttributes(disclosed DisclosedCredentialList, proofResult *ProofRes
// Check an gabi prooflist against a signature proofrequest // Check an gabi prooflist against a signature proofrequest
func checkProofWithRequest(configuration *Configuration, irmaSignature *IrmaSignedMessage, sigRequest *SignatureRequest) *SignatureProofResult { func checkProofWithRequest(configuration *Configuration, irmaSignature *IrmaSignedMessage, sigRequest *SignatureRequest) *SignatureProofResult {
disclosed, err := extractDisclosedCredentials(configuration, *irmaSignature.Signature) disclosed, err := extractDisclosedCredentials(configuration, irmaSignature.Signature)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
...@@ -310,7 +310,7 @@ func VerifySig(configuration *Configuration, irmaSignature *IrmaSignedMessage, s ...@@ -310,7 +310,7 @@ func VerifySig(configuration *Configuration, irmaSignature *IrmaSignedMessage, s
} }
// Now, cryptographically verify the signature // Now, cryptographically verify the signature
if !verify(configuration, *irmaSignature.Signature, sigRequest.GetContext(), sigRequest.GetNonce(), true) { if !verify(configuration, irmaSignature.Signature, sigRequest.GetContext(), sigRequest.GetNonce(), true) {
return &SignatureProofResult{ return &SignatureProofResult{
ProofResult: &ProofResult{ ProofResult: &ProofResult{
ProofStatus: INVALID_CRYPTO, ProofStatus: INVALID_CRYPTO,
...@@ -332,12 +332,12 @@ func VerifySigWithoutRequest(configuration *Configuration, irmaSignature *IrmaSi ...@@ -332,12 +332,12 @@ func VerifySigWithoutRequest(configuration *Configuration, irmaSignature *IrmaSi
} }
// Cryptographically verify the signature // Cryptographically verify the signature
if !verify(configuration, *irmaSignature.Signature, irmaSignature.Context, irmaSignature.GetNonce(), true) { if !verify(configuration, irmaSignature.Signature, irmaSignature.Context, irmaSignature.GetNonce(), true) {
return INVALID_CRYPTO, nil return INVALID_CRYPTO, nil
} }
// Extract attributes and return result // Extract attributes and return result
disclosed, err := extractDisclosedCredentials(configuration, *irmaSignature.Signature) disclosed, err := extractDisclosedCredentials(configuration, irmaSignature.Signature)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment