{"action":"created","issue":{"url":"https://api.github.com/repos/DeDiS/crypto/issues/29","labels_url":"https://api.github.com/repos/DeDiS/crypto/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/DeDiS/crypto/issues/29/comments","events_url":"https://api.github.com/repos/DeDiS/crypto/issues/29/events","html_url":"https://github.com/DeDiS/crypto/issues/29","id":56822842,"number":29,"title":"Encoding Bytes Arrays","user":{"login":"WEB3-GForce","id":9469966,"avatar_url":"https://avatars.githubusercontent.com/u/9469966?v=3","gravatar_id":"","url":"https://api.github.com/users/WEB3-GForce","html_url":"https://github.com/WEB3-GForce","followers_url":"https://api.github.com/users/WEB3-GForce/followers","following_url":"https://api.github.com/users/WEB3-GForce/following{/other_user}","gists_url":"https://api.github.com/users/WEB3-GForce/gists{/gist_id}","starred_url":"https://api.github.com/users/WEB3-GForce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WEB3-GForce/subscriptions","organizations_url":"https://api.github.com/users/WEB3-GForce/orgs","repos_url":"https://api.github.com/users/WEB3-GForce/repos","events_url":"https://api.github.com/users/WEB3-GForce/events{/privacy}","received_events_url":"https://api.github.com/users/WEB3-GForce/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-02-06T15:08:40Z","updated_at":"2015-02-11T22:38:27Z","closed_at":null,"body":"@davidiw\r\n@bford \r\n@jackowitzd2 \r\n\r\nI am working with abstract.Write and abstract.Read encoding. I am attempting to encode a struct of the form:\r\n\r\ntype PolicyApprovedMessage struct {\r\n\tPubKey abstract.Point\r\n\tMessage []byte\r\n        Signature []byte\r\n}\r\n\r\nwhere Message is a string converted to a byte array and signature is a digital signature of the message. When I do the encoding:\r\n\r\n\tb := bytes.Buffer{}\r\n\tabstract.Write(&b, msg, KEY_SUITE)\r\n\r\nand decoding\r\n\tb := bytes.NewBuffer(data)\r\n\terr := abstract.Read(b, msg, KEY_SUITE)\r\n\r\nThe public key comes out fine. However, the byte arrays are of length 0 when I decode. When I encode via encoding/gob, I am able to get my arrays back:\r\n\r\n//\tvar b bytes.Buffer\r\n//\tenc := gob.NewEncoder(&b)\r\n//\terr := enc.Encode(msg.Message)\r\n//\terr = enc.Encode(msg.Signature)\r\n\r\n//\tb := bytes.NewBuffer(data)\r\n//\tdec := gob.NewDecoder(b)\r\n///\terr := dec.Decode(&msg.Message)\r\n//\terr = dec.Decode(&msg.Signature)\r\n\r\nAm I simply not handling encoding of byte arrays properly, or is this an error with encoding? Could someone try encoding a byte array and seeing if they can reproduce this error?"},"comment":{"url":"https://api.github.com/repos/DeDiS/crypto/issues/comments/73980421","html_url":"https://github.com/DeDiS/crypto/issues/29#issuecomment-73980421","issue_url":"https://api.github.com/repos/DeDiS/crypto/issues/29","id":73980421,"user":{"login":"bford","id":1106207,"avatar_url":"https://avatars.githubusercontent.com/u/1106207?v=3","gravatar_id":"","url":"https://api.github.com/users/bford","html_url":"https://github.com/bford","followers_url":"https://api.github.com/users/bford/followers","following_url":"https://api.github.com/users/bford/following{/other_user}","gists_url":"https://api.github.com/users/bford/gists{/gist_id}","starred_url":"https://api.github.com/users/bford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bford/subscriptions","organizations_url":"https://api.github.com/users/bford/orgs","repos_url":"https://api.github.com/users/bford/repos","events_url":"https://api.github.com/users/bford/events{/privacy}","received_events_url":"https://api.github.com/users/bford/received_events","type":"User","site_admin":false},"created_at":"2015-02-11T22:38:27Z","updated_at":"2015-02-11T22:38:27Z","body":"Using abstract.Read/Write for cryptographic items is fine with me, and in fact I think preferable for cases where the fancier extensible protobuf encoding isn't needed."}}