diff --git a/SPEC.md b/SPEC.md index 29bf1f5..a5dc7c5 100644 --- a/SPEC.md +++ b/SPEC.md @@ -83,7 +83,7 @@ k->s: "derive new session key (wire only)" k->e: "derive key for encryption algorithm" k->e: "derive nonce for encryption algorithm" k->i: "derive key for integrity algorithm" -k->i: "derive nonce for encryption algorithm" +k->i: "derive nonce for integrity algorithm" e->e: "encrypt/decrypt" i->i: "calculate/check integrity" --> diff --git a/docs/key_derivation.svg b/docs/key_derivation.svg index 8b1d4c0..e1fe76b 100644 --- a/docs/key_derivation.svg +++ b/docs/key_derivation.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" id="mainsvg" width="818.224609375" height="352" viewBox="-10 -10 818.224609375 352"><defs><marker id="arrow" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z"/></marker><filter id="shadowfilter" x="-20%" y="-20%" width="150%" height="150%" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="linearRGB"><feDropShadow stdDeviation="4 4" in="SourceGraphic" dx="1" dy="1" flood-color="#BABABA" flood-opacity="0.9" x="0%" y="0%" width="100%" height="100%" result="dropShadow"/></filter><filter id="shadowfilter2" x="0" y="0" width="200%" height="200%" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset dy="4" dx="2"/><feGaussianBlur stdDeviation="2"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/></filter></defs><g transform="translate(0, 0)"><rect width="66.2265625" height="38" stroke="#555656" fill="white" stroke-width="1.3" transform="translate(0, 0)" rx="2" filter="url(#shadowfilter)"/><text fill="black" font-size="16" font-weight="normal" transform="translate(10, 10)" alignment-baseline="middle" font-family="Bookman"><tspan x="0" dy="16">session</tspan></text></g><g transform="translate(258.0048828125, 0)"><rect width="41.328125" height="38" stroke="#555656" fill="white" stroke-width="1.3" transform="translate(0, 0)" rx="2" filter="url(#shadowfilter)"/><text fill="black" font-size="16" font-weight="normal" transform="translate(10, 10)" alignment-baseline="middle" font-family="Bookman"><tspan x="0" dy="16">kdf</tspan></text></g><g transform="translate(497.4931640625, 0)"><rect width="88.421875" height="38" stroke="#555656" fill="white" stroke-width="1.3" transform="translate(0, 0)" rx="2" filter="url(#shadowfilter)"/><text fill="black" font-size="16" font-weight="normal" transform="translate(10, 10)" alignment-baseline="middle" font-family="Bookman"><tspan x="0" dy="16">encryption</tspan></text></g><g transform="translate(609.9150390625, 0)"><rect width="74.2109375" height="38" stroke="#555656" fill="white" stroke-width="1.3" transform="translate(0, 0)" rx="2" filter="url(#shadowfilter)"/><text fill="black" font-size="16" font-weight="normal" transform="translate(10, 10)" alignment-baseline="middle" font-family="Bookman"><tspan x="0" dy="16">integrity</tspan></text></g><path d="M 33.11328125,72 L 278.6689453125 72" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,80 L 288.6689453125 80 L 288.6689453125 98 L 278.6689453125 98" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,132 L 33.11328125 132" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,162 L 541.7041015625 162" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,192 L 541.7041015625 192" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,222 L 647.0205078125 222" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,252 L 647.0205078125 252" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 541.7041015625,260 L 551.7041015625 260 L 551.7041015625 278 L 541.7041015625 278" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 647.0205078125,290 L 657.0205078125 290 L 657.0205078125 308 L 647.0205078125 308" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 33.11328125,38 L 33.11328125 332" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1"/><path d="M 278.6689453125,38 L 278.6689453125 332" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1"/><path d="M 541.7041015625,38 L 541.7041015625 332" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1"/><path d="M 647.0205078125,38 L 647.0205078125 332" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1"/><g transform="translate(92.4892578125, 50)"><rect width="126.8037109375" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">session key and nonce</tspan></text></g><g transform="translate(290.6689453125, 80)"><rect width="50.9794921875" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">initialize</tspan></text></g><g transform="translate(57.11328125, 110)"><rect width="197.5556640625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive new session key (wire only)</tspan></text></g><g transform="translate(309.27587890625, 140)"><rect width="201.8212890625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive key for encryption algorithm</tspan></text></g><g transform="translate(302.6689453125, 170)"><rect width="215.03515625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive nonce for encryption algorithm</tspan></text></g><g transform="translate(368.1513671875, 200)"><rect width="189.38671875" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive key for integrity algorithm</tspan></text></g><g transform="translate(355.3271484375, 230)"><rect width="215.03515625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive nonce for encryption algorithm</tspan></text></g><g transform="translate(553.7041015625, 260)"><rect width="89.8486328125" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">encrypt/decrypt</tspan></text></g><g transform="translate(659.0205078125, 290)"><rect width="139.2041015625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">calculate/check integrity</tspan></text></g></svg> \ No newline at end of file +<svg xmlns="http://www.w3.org/2000/svg" id="mainsvg" width="818.224609375" height="352" viewBox="-10 -10 818.224609375 352"><defs><marker id="arrow" viewBox="0 0 10 10" refX="10" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"><path d="M 0 0 L 10 5 L 0 10 z"/></marker><filter id="shadowfilter" x="-20%" y="-20%" width="150%" height="150%" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="linearRGB"><feDropShadow stdDeviation="4 4" in="SourceGraphic" dx="1" dy="1" flood-color="#BABABA" flood-opacity="0.9" x="0%" y="0%" width="100%" height="100%" result="dropShadow"/></filter><filter id="shadowfilter2" x="0" y="0" width="200%" height="200%" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset dy="4" dx="2"/><feGaussianBlur stdDeviation="2"/><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/></filter></defs><g transform="translate(0, 0)"><rect width="66.2265625" height="38" stroke="#555656" fill="white" stroke-width="1.3" transform="translate(0, 0)" rx="2" filter="url(#shadowfilter)"/><text fill="black" font-size="16" font-weight="normal" transform="translate(10, 10)" alignment-baseline="middle" font-family="Bookman"><tspan x="0" dy="16">session</tspan></text></g><g transform="translate(258.0048828125, 0)"><rect width="41.328125" height="38" stroke="#555656" fill="white" stroke-width="1.3" transform="translate(0, 0)" rx="2" filter="url(#shadowfilter)"/><text fill="black" font-size="16" font-weight="normal" transform="translate(10, 10)" alignment-baseline="middle" font-family="Bookman"><tspan x="0" dy="16">kdf</tspan></text></g><g transform="translate(497.4931640625, 0)"><rect width="88.421875" height="38" stroke="#555656" fill="white" stroke-width="1.3" transform="translate(0, 0)" rx="2" filter="url(#shadowfilter)"/><text fill="black" font-size="16" font-weight="normal" transform="translate(10, 10)" alignment-baseline="middle" font-family="Bookman"><tspan x="0" dy="16">encryption</tspan></text></g><g transform="translate(609.9150390625, 0)"><rect width="74.2109375" height="38" stroke="#555656" fill="white" stroke-width="1.3" transform="translate(0, 0)" rx="2" filter="url(#shadowfilter)"/><text fill="black" font-size="16" font-weight="normal" transform="translate(10, 10)" alignment-baseline="middle" font-family="Bookman"><tspan x="0" dy="16">integrity</tspan></text></g><path d="M 33.11328125,72 L 278.6689453125 72" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,80 L 288.6689453125 80 L 288.6689453125 98 L 278.6689453125 98" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,132 L 33.11328125 132" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,162 L 541.7041015625 162" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,192 L 541.7041015625 192" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,222 L 647.0205078125 222" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 278.6689453125,252 L 647.0205078125 252" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 541.7041015625,260 L 551.7041015625 260 L 551.7041015625 278 L 541.7041015625 278" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 647.0205078125,290 L 657.0205078125 290 L 657.0205078125 308 L 647.0205078125 308" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1" marker-end="url(#arrow)"/><path d="M 33.11328125,38 L 33.11328125 332" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1"/><path d="M 278.6689453125,38 L 278.6689453125 332" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1"/><path d="M 541.7041015625,38 L 541.7041015625 332" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1"/><path d="M 647.0205078125,38 L 647.0205078125 332" fill="none" stroke="black" stroke-dasharray="none" stroke-width="1"/><g transform="translate(92.4892578125, 50)"><rect width="126.8037109375" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">session key and nonce</tspan></text></g><g transform="translate(290.6689453125, 80)"><rect width="50.9794921875" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">initialize</tspan></text></g><g transform="translate(57.11328125, 110)"><rect width="197.5556640625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive new session key (wire only)</tspan></text></g><g transform="translate(309.27587890625, 140)"><rect width="201.8212890625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive key for encryption algorithm</tspan></text></g><g transform="translate(302.6689453125, 170)"><rect width="215.03515625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive nonce for encryption algorithm</tspan></text></g><g transform="translate(368.1513671875, 200)"><rect width="189.38671875" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive key for integrity algorithm</tspan></text></g><g transform="translate(361.54443359375, 230)"><rect width="202.6005859375" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">derive nonce for integrity algorithm</tspan></text></g><g transform="translate(553.7041015625, 260)"><rect width="89.8486328125" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">encrypt/decrypt</tspan></text></g><g transform="translate(659.0205078125, 290)"><rect width="139.2041015625" height="18" stroke="none" fill="white" stroke-width="1" transform="translate(0, 0)" rx="5"/><text fill="black" font-size="14" font-weight="normal" transform="translate(1, 1)" alignment-baseline="middle"><tspan x="0" dy="14">calculate/check integrity</tspan></text></g></svg> \ No newline at end of file