immesys / wave

Wide Area Verified Exchange - version 3
MIT License
34 stars 15 forks source link

error in creating e2ee attestation in v0.4.0 #13

Closed ddreyer closed 5 years ago

ddreyer commented 5 years ago

Running the script below causes the following error when creating an attestation for e2ee permissions in v0.4.0, but works fine in v0.3.0:

Traceback (most recent call last):
  File "example.py", line 32, in <module>
    raise Exception(att.error.message)
Exception: (203: could not encrypt (asn1: structure error: invalid object identifier))
import grpc
import wave3 as wv

channel = grpc.insecure_channel("localhost:410")
agent = wv.WAVEStub(channel)
ent = agent.CreateEntity(wv.CreateEntityParams())
ent2 = agent.CreateEntity(wv.CreateEntityParams())
agent.PublishEntity(wv.PublishEntityParams(DER=ent.PublicDER))
agent.PublishEntity(wv.PublishEntityParams(DER=ent2.PublicDER))
perspective = wv.Perspective(
            entitySecret=wv.EntitySecret(DER=ent.SecretDER)
)
perspective2 = wv.Perspective(
            entitySecret=wv.EntitySecret(DER=ent2.SecretDER)
)

att = agent.CreateAttestation(wv.CreateAttestationParams(
        perspective=perspective,
        subjectHash=ent2.hash,
        publish=True,
        policy=wv.Policy(rTreePolicy=wv.RTreePolicy(
            namespace=ent.hash,
            indirections=5,
            statements=[
                wv.RTreePolicyStatement(
                    permissionSet=wv.WaveBuiltinPSET,
                    permissions=[wv.WaveBuiltinE2EE],
                    resource="bar",
            )]
        ))))
if att.error.code != 0:
    raise Exception(att.error.message)
immesys commented 5 years ago

This was fixed in 0.4.1, thanks for finding!