mirror of
https://github.com/vacp2p/rfc.vac.dev.git
synced 2026-01-09 16:07:54 -05:00
1 line
7.4 KiB
JavaScript
1 line
7.4 KiB
JavaScript
"use strict";(self.webpackChunklogos_docs_template=self.webpackChunklogos_docs_template||[]).push([[8514],{68957:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const i={title:"7/WAKU-DATA",name:"Waku Envelope data field",status:"stable",editor:"Oskar Thor\xe9n <oskarth@titanproxy.com>",contributors:["Dean Eigenmann <dean@status.im>","Kim De Mey <kimdemey@status.im>"]},o=void 0,l={unversionedId:"standards/legacy/7/data",id:"standards/legacy/7/data",title:"7/WAKU-DATA",description:"- Status: stable",source:"@site/waku/standards/legacy/7/data.md",sourceDirName:"standards/legacy/7",slug:"/standards/legacy/7/data",permalink:"/waku/standards/legacy/7/data",draft:!1,tags:[],version:"current",frontMatter:{title:"7/WAKU-DATA",name:"Waku Envelope data field",status:"stable",editor:"Oskar Thor\xe9n <oskarth@titanproxy.com>",contributors:["Dean Eigenmann <dean@status.im>","Kim De Mey <kimdemey@status.im>"]},sidebar:"defaultSidebar",previous:{title:"6/WAKU1",permalink:"/waku/standards/legacy/6/waku1"},next:{title:"8/WAKU-MAIL",permalink:"/waku/standards/legacy/8/mail"}},s={},d=[{value:"Specification",id:"specification",level:2},{value:"ABNF",id:"abnf",level:3},{value:"Signature",id:"signature",level:3},{value:"Padding",id:"padding",level:3},{value:"Copyright",id:"copyright",level:2}],p={toc:d};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Status: stable"),(0,r.kt)("li",{parentName:"ul"},"Editor: Oskar Thor\xe9n ","<",(0,r.kt)("a",{parentName:"li",href:"mailto:oskarth@titanproxy.com"},"oskarth@titanproxy.com"),">"),(0,r.kt)("li",{parentName:"ul"},"Contributors:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"Dean Eigenmann ","<",(0,r.kt)("a",{parentName:"li",href:"mailto:dean@status.im"},"dean@status.im"),">"),(0,r.kt)("li",{parentName:"ul"},"Kim De Mey ","<",(0,r.kt)("a",{parentName:"li",href:"mailto:kimdemey@status.im"},"kimdemey@status.im"),">")))),(0,r.kt)("p",null,"This specification describes the encryption,\ndecryption and signing of the content in the ",(0,r.kt)("a",{parentName:"p",href:"../6/waku1#abnf-specification"},"data field used in Waku"),"."),(0,r.kt)("h2",{id:"specification"},"Specification"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"data")," field is used within the ",(0,r.kt)("inlineCode",{parentName:"p"},"waku envelope"),",\nthe field MUST contain the encrypted payload of the envelope."),(0,r.kt)("p",null,"The fields that are concatenated and encrypted as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"data")," field are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"flags"),(0,r.kt)("li",{parentName:"ul"},"auxiliary field"),(0,r.kt)("li",{parentName:"ul"},"payload"),(0,r.kt)("li",{parentName:"ul"},"padding"),(0,r.kt)("li",{parentName:"ul"},"signature")),(0,r.kt)("p",null,"In case of symmetric encryption, a ",(0,r.kt)("inlineCode",{parentName:"p"},"salt"),"\n(a.k.a. AES Nonce, 12 bytes) field MUST be appended."),(0,r.kt)("h3",{id:"abnf"},"ABNF"),(0,r.kt)("p",null,"Using ",(0,r.kt)("a",{parentName:"p",href:"https://tools.ietf.org/html/rfc5234"},"Augmented Backus-Naur form (ABNF)"),"\nwe have the following format:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-abnf"},"; 1 byte; first two bits contain the size of auxiliary field, \n; third bit indicates whether the signature is present.\nflags = 1OCTET\n\n; contains the size of payload.\nauxiliary-field = 4*OCTET\n\n; byte array of arbitrary size (may be zero)\npayload = *OCTET\n\n; byte array of arbitrary size (may be zero).\npadding = *OCTET\n\n; 65 bytes, if present.\nsignature = 65OCTET\n\n; 2 bytes, if present (in case of symmetric encryption).\nsalt = 2OCTET\n\ndata = flags auxiliary-field payload padding [signature] [salt]\n")),(0,r.kt)("h3",{id:"signature"},"Signature"),(0,r.kt)("p",null,"Those unable to decrypt the envelope data are also unable to access the signature.\nThe signature, if provided,\nis the ECDSA signature of the Keccak-256 hash of the unencrypted data\nusing the secret key of the originator identity.\nThe signature is serialized as the concatenation of the ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"S")," and\n",(0,r.kt)("inlineCode",{parentName:"p"},"V")," parameters of the SECP-256k1 ECDSA signature, in that order.\n",(0,r.kt)("inlineCode",{parentName:"p"},"R")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"S")," MUST be big-endian encoded, fixed-width 256-bit unsigned.\n",(0,r.kt)("inlineCode",{parentName:"p"},"V")," MUST be an 8-bit big-endian encoded,\nnon-normalized and should be either 27 or 28."),(0,r.kt)("h3",{id:"padding"},"Padding"),(0,r.kt)("p",null,"The padding field is used to align data size,\nsince data size alone might reveal important metainformation.\nPadding can be arbitrary size.\nHowever, it is recommended that the size of Data Field (excluding the Salt)\nbefore encryption (i.e. plain text) SHOULD be factor of 256 bytes."),(0,r.kt)("h2",{id:"copyright"},"Copyright"),(0,r.kt)("p",null,"Copyright and related rights waived via ",(0,r.kt)("a",{parentName:"p",href:"https://creativecommons.org/publicdomain/zero/1.0/"},"CC0"),"."))}c.isMDXComponent=!0},3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function l(e,t){if(null==e)return{};var a,n,r=function(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),d=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=d(a),m=r,f=u["".concat(s,".").concat(m)]||u[m]||c[m]||i;return a?n.createElement(f,o(o({ref:t},p),{},{components:a})):n.createElement(f,o({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var d=2;d<i;d++)o[d]=a[d];return n.createElement.apply(null,o)}return n.createElement.apply(null,a)}u.displayName="MDXCreateElement"}}]); |