web3labs / crux

Data Privacy for Quorum Blockchains
https://www.web3labs.com
Apache License 2.0
53 stars 28 forks source link

node issue #43

Open akshitababel opened 5 years ago

akshitababel commented 5 years ago

While using the function store from enclave package I am getting the following error : time="2018-09-21T12:53:45+05:30" level=error msg="Unable to load sender public key, nacl: incorrect key length: 64" senderPubKey="[49 98 101 51 98 53 48 98 51 49 55 51 52 98 101 52 56 52 53 50 99 50 57 100 55 49 52 57 52 49 98 97 49 54 53 101 102 48 99 98 102 51 99 99 101 97 56 99 97 49 54 99 52 53 101 51 100 56 100 52 53 102 98 48]" The sender public key which I am using is a quorum node key which is: 1be3b50b31734be48452c29d714941ba165ef0cbf3ccea8ca16c45e3d8d45fb0

Puneetha17 commented 5 years ago

It would be helpful if you could elaborate on how exactly you are using the store function? Are you using any particular API in Crux or trying to call the store function from your code?

akshitababel commented 5 years ago

I am trying to call store() function from my code. The code is as below:

func CruxSecure(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
    var db storage.DataStore
    var pubKeyFiles, privKeyFiles []string
    var pi api.PartyInfo
    var client utils.HttpClient
    var grpc bool
    //var sender string
    pubKeyFiles = append(pubKeyFiles, "/home/akshita/quorum-examples/examples/7nodes/qdata/c1/tm.pub")
    pubKeyFiles = append(pubKeyFiles, "/home/akshita/quorum-examples/examples/7nodes/qdata/c2/tm.pub")
    privKeyFiles = append(privKeyFiles, "/home/akshita/quorum-examples/examples/7nodes/qdata/c1/tm.key")
    privKeyFiles = append(privKeyFiles, "/home/akshita/quorum-examples/examples/7nodes/qdata/c2/tm.key")
    message := "hello"
    grpc = true
    m := []byte(message)
    mes := &m
    sender := "1be3b50b31734be48452c29d714941ba165ef0cbf3ccea8ca16c45e3d8d45fb0"
    s := []byte(sender)
    var rec [][]byte
    recipient := "722f11686b2277dcbd72713d8a3c81c666b585c337d47f503c3c1f3c17cf001d"
    recipients := []byte(recipient)
    rec = append(rec, recipients)
    SecureEnclave := enclave.Init(db, pubKeyFiles, privKeyFiles, pi, client, grpc)

    hash, err := SecureEnclave.Store(mes, s, rec)
    if err != nil {
        util.WebResponse(w, r, http.StatusNotFound, "failed")
        return
    }
    w.Header().Set("Content-Type", "text/plain")
    w.Write(hash)
    return
}