Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CONCAT KDF #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 0 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ wrote examples and made a live table with them. Pull requests welcome!
[SHA-384 digest](#sha-384---digest) |
[SHA-512 digest](#sha-512---digest)

18. [CONCAT](#concat)
* [importKey](#concat---importkey) |
[deriveKey](#concat---derivekey) |
[deriveBits](#concat---derivebits)

19. [HKDF-CTR](#hkdf-ctr)
* [importKey](#hkdf-ctr---importkey) |
[deriveKey](#hkdf-ctr---derivekey) |
Expand Down Expand Up @@ -1797,79 +1792,6 @@ window.crypto.subtle.digest(
});
```

## CONCAT
#### CONCAT - importKey
```javascript
window.crypto.subtle.importKey(
"raw", //only "raw" is allowed
keydata, //your raw key data as an ArrayBuffer
{
name: "CONCAT",
},
false, //whether the key is extractable (i.e. can be used in exportKey)
["deriveKey", "deriveBits"] //can be any combination of "deriveKey" and "deriveBits"
)
.then(function(key){
//returns a key object
console.log(key);
})
.catch(function(err){
console.error(err);
});
```
#### CONCAT - deriveKey
```javascript
window.crypto.subtle.deriveKey(
{
"name": "CONCAT",
algorithmId: ArrayBuffer, //?????? I don't know what this should be
partyUInfo: ArrayBuffer, //?????? I don't know what this should be
partyVInfo: ArrayBuffer, //?????? I don't know what this should be
publicInfo: ArrayBuffer, //?????? I don't know what this should be
privateInfo: ArrayBuffer, //?????? I don't know what this should be
hash: {name: "SHA-1"}, //can be "SHA-1", "SHA-256", "SHA-384", or "SHA-512"
},
key, //your key from importKey
{ //the key type you want to create based on the derived bits
name: "AES-CTR", //can be any AES algorithm ("AES-CTR", "AES-CBC", "AES-CMAC", "AES-GCM", "AES-CFB", "AES-KW", "ECDH", "DH", or "HMAC")
//the generateKey parameters for that type of algorithm
length: 256, //can be 128, 192, or 256
},
false, //whether the derived key is extractable (i.e. can be used in exportKey)
["encrypt", "decrypt"] //limited to the options in that algorithm's importKey
)
.then(function(key){
//returns the derived key
console.log(key);
})
.catch(function(err){
console.error(err);
});
```
#### CONCAT - deriveBits
```javascript
window.crypto.subtle.deriveBits(
{
"name": "CONCAT",
algorithmId: ArrayBuffer, //?????? I don't know what this should be
partyUInfo: ArrayBuffer, //?????? I don't know what this should be
partyVInfo: ArrayBuffer, //?????? I don't know what this should be
publicInfo: ArrayBuffer, //?????? I don't know what this should be
privateInfo: ArrayBuffer, //?????? I don't know what this should be
hash: {name: "SHA-1"}, //can be "SHA-1", "SHA-256", "SHA-384", or "SHA-512"
},
key, //your key importKey
256 //the number of bits you want to derive
)
.then(function(bits){
//returns the derived bits as an ArrayBuffer
console.log(new Uint8Array(bits));
})
.catch(function(err){
console.error(err);
});
```

## HKDF-CTR
#### HKDF-CTR - importKey
```javascript
Expand Down
76 changes: 0 additions & 76 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4711,82 +4711,6 @@ <h1>Web Cryptography API Live Table</h1>
</tr>


<!--
##################
### CONCAT ###
##################
-->
<tr id="concatkdf">
<td class="algname"><a href="https://github.com/diafygi/webcrypto-examples/#concat">CONCAT</a></td>
<td class="encrypt disabled"></td>
<td class="decrypt disabled"></td>
<td class="sign disabled"></td>
<td class="verify disabled"></td>
<td class="digest disabled"></td>
<td class="generateKey disabled"></td>
<td class="deriveKey unsafe">
<script>
//deriveKey
var keydata = window.crypto.getRandomValues(new Uint8Array(16));
window.crypto.subtle.importKey("raw", keydata, {name: "CONCAT"}, false, ["deriveBits", "deriveKey"])
.then(function(key){

window.crypto.subtle.deriveBits({
name: "CONCAT",
algorithmId: "?????",
partyUInfo: "?????",
partyVInfo: "?????",
publicInfo: "?????",
privateInfo: "?????",
hash: {name: "SHA-1"},
}, key, AESCBC, false, ["encrypt", "decrypt"])
.then(ok("concatkdf", "deriveKey", "Yes"))
.catch(err("concatkdf", "deriveKey", "No"));

})
.catch(err("concatkdf", "deriveKey", "N/A"));
</script>
</td>
<td class="deriveBits unsafe">
<script>
//deriveBits
var keydata = window.crypto.getRandomValues(new Uint8Array(16));
window.crypto.subtle.importKey("raw", keydata, {name: "CONCAT"}, false, ["deriveBits", "deriveKey"])
.then(function(key){

window.crypto.subtle.deriveBits({
name: "CONCAT",
algorithmId: "?????",
partyUInfo: "?????",
partyVInfo: "?????",
publicInfo: "?????",
privateInfo: "?????",
hash: {name: "SHA-1"},
}, key, 128)
.then(ok("concatkdf", "deriveBits", "Yes"))
.catch(err("concatkdf", "deriveBits", "No"));

})
.catch(err("concatkdf", "deriveBits", "N/A"));
</script>
</td>
<td class="importKey unsafe">
<script>
//importKey

//raw
var keydata = window.crypto.getRandomValues(new Uint8Array(16));
window.crypto.subtle.importKey("raw", keydata, {name: "CONCAT"}, false, ["deriveBits", "deriveKey"])
.then(ok("concatkdf", "importKey", "raw"))
.catch(err("concatkdf", "importKey", "raw*"));
</script>
</td>
<td class="exportKey disabled"></td>
<td class="wrapKey disabled"></td>
<td class="unwrapKey disabled"></td>
</tr>


<!--
####################
### HKDF-CTR ###
Expand Down