Update crypto.js with template strings
This commit is contained in:
parent
c8403064f3
commit
3fc92abc8c
1 changed files with 181 additions and 191 deletions
|
@ -46,25 +46,19 @@ make.crypto = {
|
||||||
randomJwkKeyType: () => random.subset(make.crypto.jwkKeyTypes),
|
randomJwkKeyType: () => random.subset(make.crypto.jwkKeyTypes),
|
||||||
algorithmNames: {
|
algorithmNames: {
|
||||||
// https://www.w3.org/TR/WebCryptoAPI/#algorithm-overview
|
// https://www.w3.org/TR/WebCryptoAPI/#algorithm-overview
|
||||||
digestNames: [
|
sign: [
|
||||||
'SHA1',
|
|
||||||
'SHA-256',
|
|
||||||
'SHA-384',
|
|
||||||
'SHA-512'
|
|
||||||
],
|
|
||||||
signAlgorithms: [
|
|
||||||
'RSASSA-PKCS1-v1_5',
|
'RSASSA-PKCS1-v1_5',
|
||||||
'RSA-PSS',
|
'RSA-PSS',
|
||||||
'ECDSA',
|
'ECDSA',
|
||||||
'HMAC'
|
'HMAC'
|
||||||
],
|
],
|
||||||
verifyAlgorithms: [
|
verify: [
|
||||||
'RSASSA-PKCS1-v1_5',
|
'RSASSA-PKCS1-v1_5',
|
||||||
'RSA-PSS',
|
'RSA-PSS',
|
||||||
'ECDSA',
|
'ECDSA',
|
||||||
'HMAC'
|
'HMAC'
|
||||||
],
|
],
|
||||||
generateKeyAlgorithms: [
|
generateKey: [
|
||||||
'RSASSA-PKCS1-v1_5',
|
'RSASSA-PKCS1-v1_5',
|
||||||
'RSA-PSS',
|
'RSA-PSS',
|
||||||
'RSA-OAEP',
|
'RSA-OAEP',
|
||||||
|
@ -76,7 +70,7 @@ make.crypto = {
|
||||||
'AES-KW',
|
'AES-KW',
|
||||||
'HMAC'
|
'HMAC'
|
||||||
],
|
],
|
||||||
importKeyAlgorithms: [
|
importKey: [
|
||||||
'RSASSA-PKCS1-v1_5',
|
'RSASSA-PKCS1-v1_5',
|
||||||
'RSA-PSS',
|
'RSA-PSS',
|
||||||
'RSA-OAEP',
|
'RSA-OAEP',
|
||||||
|
@ -90,7 +84,7 @@ make.crypto = {
|
||||||
'HKDF',
|
'HKDF',
|
||||||
'PBKDF2'
|
'PBKDF2'
|
||||||
],
|
],
|
||||||
exportKeyAlgorithms: [
|
exportKey: [
|
||||||
'RSASSA-PKCS1-v1_5',
|
'RSASSA-PKCS1-v1_5',
|
||||||
'RSA-PSS',
|
'RSA-PSS',
|
||||||
'RSA-OAEP',
|
'RSA-OAEP',
|
||||||
|
@ -146,7 +140,7 @@ make.crypto = {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
randomAlgorithmName: (method) => random.item(make.crypto.algorithmNames[method]),
|
randomAlgorithmName: (method) => random.item(make.crypto.algorithmNames[method]),
|
||||||
supportedAlgorithms: () => Object.keys(make.crypto.algorithms),
|
randomDigestName: () => random.item(make.crypto.algorithmNames.digest),
|
||||||
algorithms: {
|
algorithms: {
|
||||||
/* (Unsupported as of 30/01/2017)
|
/* (Unsupported as of 30/01/2017)
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
@ -166,20 +160,20 @@ make.crypto = {
|
||||||
return len || random.item([1, 256, 384, 512])
|
return len || random.item([1, 256, 384, 512])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'RSASSA-PKCS1-v1_5',
|
name: 'RSASSA-PKCS1-v1_5',
|
||||||
hash: {
|
hash: {
|
||||||
name: `SHA-${this.length(len)}`
|
name: 'SHA-${this.length(len)}'
|
||||||
},
|
},
|
||||||
modulusLength: random.item([1024, 2048, 4096]),
|
modulusLength: ${random.item([1024, 2048, 4096])},
|
||||||
publicExponent: new Uint8Array([0x01, 0x00, 0x01])
|
publicExponent: new Uint8Array([0x01, 0x00, 0x01])
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'RSA',
|
kty: 'RSA',
|
||||||
alg: `RS${this.length(len)}`
|
alg: 'RS${this.length(len)}'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -217,8 +211,8 @@ make.crypto = {
|
||||||
ext: true
|
ext: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
spki: new Uint8Array([48, 129, 159, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 129, 141, 0, 48, 129, 137, 2, 129, 129, 0, 182, 93, 35, 213, 252, 204, 20, 103, 91, 238, 105, 199, 53, 114, 24, 221, 114, 210, 137, 173, 88, 76, 205, 113, 148, 148, 79, 80, 59, 208, 60, 75, 231, 248, 78, 125, 12, 30, 237, 226, 63, 146, 157, 203, 239, 60, 138, 123, 234, 50, 23, 174, 216, 33, 122, 16, 53, 246, 140, 254, 75, 246, 205, 204, 117, 204, 115, 29, 178, 102, 139, 201, 74, 177, 45, 131, 183, 166, 234, 61, 124, 75, 110, 3, 70, 202, 148, 95, 45, 228, 94, 95, 148, 2, 162, 79, 146, 137, 29, 189, 102, 75, 207, 214, 116, 58, 63, 171, 219, 27, 5, 9, 108, 16, 218, 23, 169, 43, 181, 119, 31, 172, 95, 205, 180, 18, 255, 203, 2, 3, 1, 0, 1]),
|
spki: 'new Uint8Array([48, 129, 159, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 129, 141, 0, 48, 129, 137, 2, 129, 129, 0, 182, 93, 35, 213, 252, 204, 20, 103, 91, 238, 105, 199, 53, 114, 24, 221, 114, 210, 137, 173, 88, 76, 205, 113, 148, 148, 79, 80, 59, 208, 60, 75, 231, 248, 78, 125, 12, 30, 237, 226, 63, 146, 157, 203, 239, 60, 138, 123, 234, 50, 23, 174, 216, 33, 122, 16, 53, 246, 140, 254, 75, 246, 205, 204, 117, 204, 115, 29, 178, 102, 139, 201, 74, 177, 45, 131, 183, 166, 234, 61, 124, 75, 110, 3, 70, 202, 148, 95, 45, 228, 94, 95, 148, 2, 162, 79, 146, 137, 29, 189, 102, 75, 207, 214, 116, 58, 63, 171, 219, 27, 5, 9, 108, 16, 218, 23, 169, 43, 181, 119, 31, 172, 95, 205, 180, 18, 255, 203, 2, 3, 1, 0, 1])',
|
||||||
pkcs8: new Uint8Array([48, 130, 2, 118, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 2, 96, 48, 130, 2, 92, 2, 1, 0, 2, 129, 129, 0, 217, 78, 147, 218, 221, 152, 10, 66, 75, 127, 242, 108, 182, 142, 157, 44, 93, 58, 176, 193, 135, 103, 216, 179, 69, 72, 38, 115, 144, 244, 12, 139, 0, 245, 48, 115, 204, 234, 158, 193, 231, 127, 178, 240, 244, 203, 35, 229, 203, 245, 110, 215, 199, 19, 98, 183, 164, 223, 159, 203, 128, 123, 173, 26, 12, 172, 250, 99, 254, 35, 225, 221, 39, 51, 62, 3, 139, 35, 38, 164, 71, 238, 240, 73, 139, 214, 68, 172, 204, 253, 171, 244, 14, 186, 152, 159, 225, 133, 229, 140, 99, 50, 183, 242, 217, 248, 86, 233, 20, 117, 42, 136, 55, 8, 65, 124, 244, 65, 29, 15, 194, 255, 78, 31, 189, 146, 105, 161, 2, 3, 1, 0, 1, 2, 129, 128, 26, 88, 13, 82, 166, 52, 141, 97, 214, 23, 79, 195, 96, 42, 79, 225, 149, 247, 204, 127, 217, 179, 124, 48, 215, 128, 84, 177, 3, 236, 162, 44, 163, 212, 21, 168, 164, 57, 249, 63, 22, 154, 131, 141, 244, 143, 63, 237, 214, 217, 13, 51, 249, 125, 95, 37, 86, 70, 137, 239, 184, 198, 197, 136, 62, 183, 41, 78, 118, 234, 57, 195, 161, 219, 173, 234, 61, 11, 165, 109, 209, 9, 3, 22, 186, 114, 32, 135, 147, 74, 6, 106, 190, 214, 36, 208, 32, 220, 61, 12, 41, 105, 251, 247, 18, 159, 3, 198, 28, 228, 36, 44, 189, 125, 45, 72, 233, 199, 12, 72, 91, 106, 165, 246, 217, 58, 168, 53, 2, 65, 0, 241, 112, 53, 166, 98, 11, 38, 73, 58, 156, 84, 190, 118, 74, 247, 229, 85, 178, 83, 231, 53, 137, 237, 228, 246, 12, 32, 206, 157, 198, 152, 70, 11, 185, 234, 30, 112, 23, 115, 249, 68, 176, 159, 108, 247, 249, 207, 152, 145, 166, 246, 79, 176, 219, 163, 111, 243, 4, 49, 3, 239, 242, 63, 147, 2, 65, 0, 230, 105, 200, 1, 208, 201, 237, 225, 85, 27, 39, 216, 193, 1, 253, 168, 88, 15, 242, 166, 70, 106, 235, 2, 92, 24, 130, 66, 176, 176, 220, 238, 66, 12, 159, 26, 24, 40, 19, 213, 138, 98, 238, 98, 220, 65, 148, 116, 146, 21, 0, 25, 6, 177, 57, 216, 70, 51, 149, 244, 157, 153, 106, 123, 2, 64, 127, 92, 254, 48, 67, 80, 54, 102, 50, 240, 253, 19, 108, 59, 168, 1, 230, 239, 39, 171, 180, 102, 138, 132, 89, 247, 147, 230, 234, 252, 52, 159, 222, 215, 184, 85, 78, 52, 81, 13, 145, 218, 202, 127, 37, 97, 54, 205, 249, 39, 230, 143, 171, 112, 114, 11, 64, 91, 89, 176, 6, 7, 248, 217, 2, 65, 0, 220, 94, 95, 132, 29, 4, 132, 22, 247, 38, 185, 189, 125, 27, 66, 87, 55, 162, 73, 24, 238, 80, 99, 228, 37, 224, 234, 244, 141, 185, 26, 20, 101, 231, 92, 99, 192, 166, 212, 17, 112, 1, 158, 173, 190, 170, 154, 41, 195, 109, 130, 98, 109, 28, 35, 142, 205, 213, 152, 158, 19, 253, 30, 241, 2, 64, 15, 148, 8, 16, 189, 122, 55, 109, 203, 175, 173, 24, 222, 36, 130, 130, 179, 87, 189, 32, 141, 149, 30, 115, 211, 227, 79, 234, 78, 202, 253, 48, 173, 95, 167, 203, 20, 193, 160, 30, 146, 33, 109, 4, 221, 25, 212, 216, 183, 100, 18, 46, 184, 52, 65, 146, 249, 68, 225, 10, 84, 38, 98, 133])
|
pkcs8: 'new Uint8Array([48, 130, 2, 118, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 2, 96, 48, 130, 2, 92, 2, 1, 0, 2, 129, 129, 0, 217, 78, 147, 218, 221, 152, 10, 66, 75, 127, 242, 108, 182, 142, 157, 44, 93, 58, 176, 193, 135, 103, 216, 179, 69, 72, 38, 115, 144, 244, 12, 139, 0, 245, 48, 115, 204, 234, 158, 193, 231, 127, 178, 240, 244, 203, 35, 229, 203, 245, 110, 215, 199, 19, 98, 183, 164, 223, 159, 203, 128, 123, 173, 26, 12, 172, 250, 99, 254, 35, 225, 221, 39, 51, 62, 3, 139, 35, 38, 164, 71, 238, 240, 73, 139, 214, 68, 172, 204, 253, 171, 244, 14, 186, 152, 159, 225, 133, 229, 140, 99, 50, 183, 242, 217, 248, 86, 233, 20, 117, 42, 136, 55, 8, 65, 124, 244, 65, 29, 15, 194, 255, 78, 31, 189, 146, 105, 161, 2, 3, 1, 0, 1, 2, 129, 128, 26, 88, 13, 82, 166, 52, 141, 97, 214, 23, 79, 195, 96, 42, 79, 225, 149, 247, 204, 127, 217, 179, 124, 48, 215, 128, 84, 177, 3, 236, 162, 44, 163, 212, 21, 168, 164, 57, 249, 63, 22, 154, 131, 141, 244, 143, 63, 237, 214, 217, 13, 51, 249, 125, 95, 37, 86, 70, 137, 239, 184, 198, 197, 136, 62, 183, 41, 78, 118, 234, 57, 195, 161, 219, 173, 234, 61, 11, 165, 109, 209, 9, 3, 22, 186, 114, 32, 135, 147, 74, 6, 106, 190, 214, 36, 208, 32, 220, 61, 12, 41, 105, 251, 247, 18, 159, 3, 198, 28, 228, 36, 44, 189, 125, 45, 72, 233, 199, 12, 72, 91, 106, 165, 246, 217, 58, 168, 53, 2, 65, 0, 241, 112, 53, 166, 98, 11, 38, 73, 58, 156, 84, 190, 118, 74, 247, 229, 85, 178, 83, 231, 53, 137, 237, 228, 246, 12, 32, 206, 157, 198, 152, 70, 11, 185, 234, 30, 112, 23, 115, 249, 68, 176, 159, 108, 247, 249, 207, 152, 145, 166, 246, 79, 176, 219, 163, 111, 243, 4, 49, 3, 239, 242, 63, 147, 2, 65, 0, 230, 105, 200, 1, 208, 201, 237, 225, 85, 27, 39, 216, 193, 1, 253, 168, 88, 15, 242, 166, 70, 106, 235, 2, 92, 24, 130, 66, 176, 176, 220, 238, 66, 12, 159, 26, 24, 40, 19, 213, 138, 98, 238, 98, 220, 65, 148, 116, 146, 21, 0, 25, 6, 177, 57, 216, 70, 51, 149, 244, 157, 153, 106, 123, 2, 64, 127, 92, 254, 48, 67, 80, 54, 102, 50, 240, 253, 19, 108, 59, 168, 1, 230, 239, 39, 171, 180, 102, 138, 132, 89, 247, 147, 230, 234, 252, 52, 159, 222, 215, 184, 85, 78, 52, 81, 13, 145, 218, 202, 127, 37, 97, 54, 205, 249, 39, 230, 143, 171, 112, 114, 11, 64, 91, 89, 176, 6, 7, 248, 217, 2, 65, 0, 220, 94, 95, 132, 29, 4, 132, 22, 247, 38, 185, 189, 125, 27, 66, 87, 55, 162, 73, 24, 238, 80, 99, 228, 37, 224, 234, 244, 141, 185, 26, 20, 101, 231, 92, 99, 192, 166, 212, 17, 112, 1, 158, 173, 190, 170, 154, 41, 195, 109, 130, 98, 109, 28, 35, 142, 205, 213, 152, 158, 19, 253, 30, 241, 2, 64, 15, 148, 8, 16, 189, 122, 55, 109, 203, 175, 173, 24, 222, 36, 130, 130, 179, 87, 189, 32, 141, 149, 30, 115, 211, 227, 79, 234, 78, 202, 253, 48, 173, 95, 167, 203, 20, 193, 160, 30, 146, 33, 109, 4, 221, 25, 212, 216, 183, 100, 18, 46, 184, 52, 65, 146, 249, 68, 225, 10, 84, 38, 98, 133])'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'RSA-PSS': {
|
'RSA-PSS': {
|
||||||
|
@ -227,21 +221,21 @@ make.crypto = {
|
||||||
return len || random.item([1, 256, 384, 512])
|
return len || random.item([1, 256, 384, 512])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'RSA-PSS',
|
name: 'RSA-PSS',
|
||||||
hash: {
|
hash: {
|
||||||
name: `SHA-${this.length(len)}`
|
name: 'SHA-${this.length(len)}'
|
||||||
},
|
},
|
||||||
modulusLength: random.item([1024, 2048, 4096]),
|
modulusLength: ${random.item([1024, 2048, 4096])},
|
||||||
publicExponent: new Uint8Array([0x01, 0x00, 0x00]),
|
publicExponent: new Uint8Array([0x01, 0x00, 0x00]),
|
||||||
saltLength: 8
|
saltLength: 8
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'RSA',
|
kty: 'RSA',
|
||||||
alg: `PS${this.length(len)}`
|
alg: 'PS${this.length(len)}'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -279,8 +273,8 @@ make.crypto = {
|
||||||
ext: true
|
ext: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
spki: new Uint8Array([48, 129, 159, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 129, 141, 0, 48, 129, 137, 2, 129, 129, 0, 180, 31, 227, 200, 37, 227, 65, 238, 23, 91, 226, 130, 51, 32, 165, 245, 1, 24, 244, 5, 184, 42, 181, 155, 23, 142, 249, 220, 222, 131, 175, 54, 117, 135, 64, 232, 120, 90, 160, 221, 18, 31, 200, 41, 23, 174, 18, 172, 247, 166, 90, 37, 156, 229, 2, 70, 169, 165, 93, 246, 120, 117, 59, 202, 3, 102, 44, 119, 154, 54, 28, 198, 111, 39, 144, 73, 69, 251, 179, 74, 41, 215, 115, 186, 124, 200, 105, 75, 104, 158, 156, 158, 238, 214, 14, 81, 95, 130, 155, 146, 114, 125, 88, 158, 212, 44, 65, 236, 228, 194, 105, 96, 211, 155, 60, 71, 134, 90, 151, 202, 68, 20, 228, 105, 249, 202, 170, 155, 2, 3, 1, 0, 1]),
|
spki: 'new Uint8Array([48, 129, 159, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 129, 141, 0, 48, 129, 137, 2, 129, 129, 0, 180, 31, 227, 200, 37, 227, 65, 238, 23, 91, 226, 130, 51, 32, 165, 245, 1, 24, 244, 5, 184, 42, 181, 155, 23, 142, 249, 220, 222, 131, 175, 54, 117, 135, 64, 232, 120, 90, 160, 221, 18, 31, 200, 41, 23, 174, 18, 172, 247, 166, 90, 37, 156, 229, 2, 70, 169, 165, 93, 246, 120, 117, 59, 202, 3, 102, 44, 119, 154, 54, 28, 198, 111, 39, 144, 73, 69, 251, 179, 74, 41, 215, 115, 186, 124, 200, 105, 75, 104, 158, 156, 158, 238, 214, 14, 81, 95, 130, 155, 146, 114, 125, 88, 158, 212, 44, 65, 236, 228, 194, 105, 96, 211, 155, 60, 71, 134, 90, 151, 202, 68, 20, 228, 105, 249, 202, 170, 155, 2, 3, 1, 0, 1])',
|
||||||
plcs8: new Uint8Array([48, 130, 2, 119, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 2, 97, 48, 130, 2, 93, 2, 1, 0, 2, 129, 129, 0, 180, 31, 227, 200, 37, 227, 65, 238, 23, 91, 226, 130, 51, 32, 165, 245, 1, 24, 244, 5, 184, 42, 181, 155, 23, 142, 249, 220, 222, 131, 175, 54, 117, 135, 64, 232, 120, 90, 160, 221, 18, 31, 200, 41, 23, 174, 18, 172, 247, 166, 90, 37, 156, 229, 2, 70, 169, 165, 93, 246, 120, 117, 59, 202, 3, 102, 44, 119, 154, 54, 28, 198, 111, 39, 144, 73, 69, 251, 179, 74, 41, 215, 115, 186, 124, 200, 105, 75, 104, 158, 156, 158, 238, 214, 14, 81, 95, 130, 155, 146, 114, 125, 88, 158, 212, 44, 65, 236, 228, 194, 105, 96, 211, 155, 60, 71, 134, 90, 151, 202, 68, 20, 228, 105, 249, 202, 170, 155, 2, 3, 1, 0, 1, 2, 129, 128, 102, 251, 236, 161, 220, 119, 168, 148, 86, 42, 164, 192, 200, 54, 156, 108, 14, 42, 148, 42, 72, 247, 178, 73, 112, 24, 192, 230, 245, 25, 217, 45, 139, 216, 190, 213, 171, 42, 53, 218, 239, 167, 216, 43, 22, 108, 226, 36, 158, 155, 47, 227, 93, 102, 217, 252, 72, 182, 81, 152, 191, 154, 87, 137, 219, 194, 236, 53, 200, 123, 61, 10, 59, 231, 41, 18, 116, 77, 148, 50, 170, 116, 221, 110, 170, 190, 158, 108, 217, 38, 73, 84, 183, 51, 122, 179, 217, 143, 255, 87, 82, 80, 223, 188, 84, 134, 146, 150, 169, 64, 30, 168, 104, 8, 123, 162, 46, 59, 47, 232, 0, 35, 202, 42, 195, 141, 6, 1, 2, 65, 0, 237, 171, 148, 110, 241, 19, 152, 216, 206, 77, 109, 215, 21, 144, 110, 96, 34, 61, 46, 214, 148, 70, 238, 119, 206, 128, 32, 24, 136, 197, 185, 254, 209, 35, 235, 231, 122, 246, 167, 183, 117, 176, 51, 133, 169, 47, 130, 178, 40, 225, 145, 219, 48, 56, 21, 46, 198, 18, 85, 218, 194, 150, 141, 27, 2, 65, 0, 194, 4, 41, 152, 43, 246, 147, 7, 229, 244, 215, 110, 143, 7, 184, 187, 22, 166, 113, 217, 81, 52, 205, 54, 73, 202, 244, 24, 24, 219, 254, 243, 230, 230, 212, 172, 225, 218, 112, 95, 118, 103, 144, 223, 248, 164, 19, 228, 204, 204, 64, 91, 76, 77, 4, 206, 89, 173, 154, 162, 134, 113, 176, 129, 2, 64, 58, 4, 78, 97, 158, 155, 200, 13, 244, 158, 86, 23, 208, 253, 198, 211, 212, 199, 214, 173, 46, 216, 249, 209, 105, 41, 65, 172, 123, 134, 184, 214, 137, 59, 25, 149, 18, 33, 47, 227, 202, 232, 206, 74, 236, 119, 218, 145, 159, 5, 33, 83, 190, 59, 146, 128, 46, 125, 191, 83, 125, 120, 190, 205, 2, 65, 0, 134, 6, 204, 25, 20, 29, 180, 250, 90, 207, 229, 214, 185, 53, 211, 86, 98, 210, 62, 137, 170, 128, 120, 86, 205, 105, 71, 112, 50, 20, 31, 174, 171, 206, 192, 18, 97, 191, 61, 171, 164, 166, 236, 188, 220, 13, 180, 180, 117, 9, 144, 87, 193, 128, 223, 22, 17, 123, 76, 252, 131, 53, 156, 129, 2, 65, 0, 178, 29, 141, 176, 179, 203, 180, 190, 224, 34, 134, 226, 151, 73, 139, 163, 47, 17, 179, 117, 167, 200, 255, 174, 67, 114, 158, 96, 195, 176, 163, 241, 96, 24, 72, 35, 38, 18, 132, 176, 76, 235, 8, 29, 225, 138, 155, 191, 97, 158, 3, 22, 114, 133, 176, 213, 207, 120, 33, 55, 52, 135, 79, 161])
|
plcs8: 'new Uint8Array([48, 130, 2, 119, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 2, 97, 48, 130, 2, 93, 2, 1, 0, 2, 129, 129, 0, 180, 31, 227, 200, 37, 227, 65, 238, 23, 91, 226, 130, 51, 32, 165, 245, 1, 24, 244, 5, 184, 42, 181, 155, 23, 142, 249, 220, 222, 131, 175, 54, 117, 135, 64, 232, 120, 90, 160, 221, 18, 31, 200, 41, 23, 174, 18, 172, 247, 166, 90, 37, 156, 229, 2, 70, 169, 165, 93, 246, 120, 117, 59, 202, 3, 102, 44, 119, 154, 54, 28, 198, 111, 39, 144, 73, 69, 251, 179, 74, 41, 215, 115, 186, 124, 200, 105, 75, 104, 158, 156, 158, 238, 214, 14, 81, 95, 130, 155, 146, 114, 125, 88, 158, 212, 44, 65, 236, 228, 194, 105, 96, 211, 155, 60, 71, 134, 90, 151, 202, 68, 20, 228, 105, 249, 202, 170, 155, 2, 3, 1, 0, 1, 2, 129, 128, 102, 251, 236, 161, 220, 119, 168, 148, 86, 42, 164, 192, 200, 54, 156, 108, 14, 42, 148, 42, 72, 247, 178, 73, 112, 24, 192, 230, 245, 25, 217, 45, 139, 216, 190, 213, 171, 42, 53, 218, 239, 167, 216, 43, 22, 108, 226, 36, 158, 155, 47, 227, 93, 102, 217, 252, 72, 182, 81, 152, 191, 154, 87, 137, 219, 194, 236, 53, 200, 123, 61, 10, 59, 231, 41, 18, 116, 77, 148, 50, 170, 116, 221, 110, 170, 190, 158, 108, 217, 38, 73, 84, 183, 51, 122, 179, 217, 143, 255, 87, 82, 80, 223, 188, 84, 134, 146, 150, 169, 64, 30, 168, 104, 8, 123, 162, 46, 59, 47, 232, 0, 35, 202, 42, 195, 141, 6, 1, 2, 65, 0, 237, 171, 148, 110, 241, 19, 152, 216, 206, 77, 109, 215, 21, 144, 110, 96, 34, 61, 46, 214, 148, 70, 238, 119, 206, 128, 32, 24, 136, 197, 185, 254, 209, 35, 235, 231, 122, 246, 167, 183, 117, 176, 51, 133, 169, 47, 130, 178, 40, 225, 145, 219, 48, 56, 21, 46, 198, 18, 85, 218, 194, 150, 141, 27, 2, 65, 0, 194, 4, 41, 152, 43, 246, 147, 7, 229, 244, 215, 110, 143, 7, 184, 187, 22, 166, 113, 217, 81, 52, 205, 54, 73, 202, 244, 24, 24, 219, 254, 243, 230, 230, 212, 172, 225, 218, 112, 95, 118, 103, 144, 223, 248, 164, 19, 228, 204, 204, 64, 91, 76, 77, 4, 206, 89, 173, 154, 162, 134, 113, 176, 129, 2, 64, 58, 4, 78, 97, 158, 155, 200, 13, 244, 158, 86, 23, 208, 253, 198, 211, 212, 199, 214, 173, 46, 216, 249, 209, 105, 41, 65, 172, 123, 134, 184, 214, 137, 59, 25, 149, 18, 33, 47, 227, 202, 232, 206, 74, 236, 119, 218, 145, 159, 5, 33, 83, 190, 59, 146, 128, 46, 125, 191, 83, 125, 120, 190, 205, 2, 65, 0, 134, 6, 204, 25, 20, 29, 180, 250, 90, 207, 229, 214, 185, 53, 211, 86, 98, 210, 62, 137, 170, 128, 120, 86, 205, 105, 71, 112, 50, 20, 31, 174, 171, 206, 192, 18, 97, 191, 61, 171, 164, 166, 236, 188, 220, 13, 180, 180, 117, 9, 144, 87, 193, 128, 223, 22, 17, 123, 76, 252, 131, 53, 156, 129, 2, 65, 0, 178, 29, 141, 176, 179, 203, 180, 190, 224, 34, 134, 226, 151, 73, 139, 163, 47, 17, 179, 117, 167, 200, 255, 174, 67, 114, 158, 96, 195, 176, 163, 241, 96, 24, 72, 35, 38, 18, 132, 176, 76, 235, 8, 29, 225, 138, 155, 191, 97, 158, 3, 22, 114, 133, 176, 213, 207, 120, 33, 55, 52, 135, 79, 161])'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'RSA-OAEP': {
|
'RSA-OAEP': {
|
||||||
|
@ -290,20 +284,20 @@ make.crypto = {
|
||||||
return len || random.item([1, 256, 384, 512])
|
return len || random.item([1, 256, 384, 512])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'RSA-OAEP',
|
name: 'RSA-OAEP',
|
||||||
hash: {
|
hash: {
|
||||||
name: `SHA-${this.length(len)}`
|
name: 'SHA-${this.length(len)}'
|
||||||
},
|
},
|
||||||
modulusLength: random.item([1024, 2048, 4096]),
|
modulusLength: ${random.item([1024, 2048, 4096])},
|
||||||
publicExponent: new Uint8Array([0x01, 0x00, 0x01])
|
publicExponent: new Uint8Array([0x01, 0x00, 0x01])
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'RSA',
|
kty: 'RSA',
|
||||||
alg: `RSA-OAEP-${this.length(len)}`
|
alg: 'RSA-OAEP-${this.length(len)}'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -312,15 +306,18 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
encrypt: function () {
|
encrypt: function () {
|
||||||
return Object.assign(
|
utils.common.mockup(`{
|
||||||
this.alg(),
|
name: 'RSA-OAEP',
|
||||||
{
|
hash: {
|
||||||
|
name: 'SHA-${this.length()}'
|
||||||
|
},
|
||||||
|
modulusLength: ${random.item([1024, 2048, 4096])},
|
||||||
|
publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
|
||||||
label: crypto.getRandomValues(new Uint8Array(16))
|
label: crypto.getRandomValues(new Uint8Array(16))
|
||||||
}
|
}`)
|
||||||
)
|
|
||||||
},
|
},
|
||||||
decrypt: function () {
|
decrypt: function () {
|
||||||
return self.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
unwrapKey: function () {
|
unwrapKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -352,8 +349,8 @@ make.crypto = {
|
||||||
ext: true
|
ext: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
spki: new Uint8Array([48, 129, 159, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 129, 141, 0, 48, 129, 137, 2, 129, 129, 0, 182, 93, 35, 213, 252, 204, 20, 103, 91, 238, 105, 199, 53, 114, 24, 221, 114, 210, 137, 173, 88, 76, 205, 113, 148, 148, 79, 80, 59, 208, 60, 75, 231, 248, 78, 125, 12, 30, 237, 226, 63, 146, 157, 203, 239, 60, 138, 123, 234, 50, 23, 174, 216, 33, 122, 16, 53, 246, 140, 254, 75, 246, 205, 204, 117, 204, 115, 29, 178, 102, 139, 201, 74, 177, 45, 131, 183, 166, 234, 61, 124, 75, 110, 3, 70, 202, 148, 95, 45, 228, 94, 95, 148, 2, 162, 79, 146, 137, 29, 189, 102, 75, 207, 214, 116, 58, 63, 171, 219, 27, 5, 9, 108, 16, 218, 23, 169, 43, 181, 119, 31, 172, 95, 205, 180, 18, 255, 203, 2, 3, 1, 0, 1]),
|
spki: 'new Uint8Array([48, 129, 159, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 129, 141, 0, 48, 129, 137, 2, 129, 129, 0, 182, 93, 35, 213, 252, 204, 20, 103, 91, 238, 105, 199, 53, 114, 24, 221, 114, 210, 137, 173, 88, 76, 205, 113, 148, 148, 79, 80, 59, 208, 60, 75, 231, 248, 78, 125, 12, 30, 237, 226, 63, 146, 157, 203, 239, 60, 138, 123, 234, 50, 23, 174, 216, 33, 122, 16, 53, 246, 140, 254, 75, 246, 205, 204, 117, 204, 115, 29, 178, 102, 139, 201, 74, 177, 45, 131, 183, 166, 234, 61, 124, 75, 110, 3, 70, 202, 148, 95, 45, 228, 94, 95, 148, 2, 162, 79, 146, 137, 29, 189, 102, 75, 207, 214, 116, 58, 63, 171, 219, 27, 5, 9, 108, 16, 218, 23, 169, 43, 181, 119, 31, 172, 95, 205, 180, 18, 255, 203, 2, 3, 1, 0, 1])',
|
||||||
pkcs8: new Uint8Array([48, 130, 2, 118, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 2, 96, 48, 130, 2, 92, 2, 1, 0, 2, 129, 129, 0, 217, 78, 147, 218, 221, 152, 10, 66, 75, 127, 242, 108, 182, 142, 157, 44, 93, 58, 176, 193, 135, 103, 216, 179, 69, 72, 38, 115, 144, 244, 12, 139, 0, 245, 48, 115, 204, 234, 158, 193, 231, 127, 178, 240, 244, 203, 35, 229, 203, 245, 110, 215, 199, 19, 98, 183, 164, 223, 159, 203, 128, 123, 173, 26, 12, 172, 250, 99, 254, 35, 225, 221, 39, 51, 62, 3, 139, 35, 38, 164, 71, 238, 240, 73, 139, 214, 68, 172, 204, 253, 171, 244, 14, 186, 152, 159, 225, 133, 229, 140, 99, 50, 183, 242, 217, 248, 86, 233, 20, 117, 42, 136, 55, 8, 65, 124, 244, 65, 29, 15, 194, 255, 78, 31, 189, 146, 105, 161, 2, 3, 1, 0, 1, 2, 129, 128, 26, 88, 13, 82, 166, 52, 141, 97, 214, 23, 79, 195, 96, 42, 79, 225, 149, 247, 204, 127, 217, 179, 124, 48, 215, 128, 84, 177, 3, 236, 162, 44, 163, 212, 21, 168, 164, 57, 249, 63, 22, 154, 131, 141, 244, 143, 63, 237, 214, 217, 13, 51, 249, 125, 95, 37, 86, 70, 137, 239, 184, 198, 197, 136, 62, 183, 41, 78, 118, 234, 57, 195, 161, 219, 173, 234, 61, 11, 165, 109, 209, 9, 3, 22, 186, 114, 32, 135, 147, 74, 6, 106, 190, 214, 36, 208, 32, 220, 61, 12, 41, 105, 251, 247, 18, 159, 3, 198, 28, 228, 36, 44, 189, 125, 45, 72, 233, 199, 12, 72, 91, 106, 165, 246, 217, 58, 168, 53, 2, 65, 0, 241, 112, 53, 166, 98, 11, 38, 73, 58, 156, 84, 190, 118, 74, 247, 229, 85, 178, 83, 231, 53, 137, 237, 228, 246, 12, 32, 206, 157, 198, 152, 70, 11, 185, 234, 30, 112, 23, 115, 249, 68, 176, 159, 108, 247, 249, 207, 152, 145, 166, 246, 79, 176, 219, 163, 111, 243, 4, 49, 3, 239, 242, 63, 147, 2, 65, 0, 230, 105, 200, 1, 208, 201, 237, 225, 85, 27, 39, 216, 193, 1, 253, 168, 88, 15, 242, 166, 70, 106, 235, 2, 92, 24, 130, 66, 176, 176, 220, 238, 66, 12, 159, 26, 24, 40, 19, 213, 138, 98, 238, 98, 220, 65, 148, 116, 146, 21, 0, 25, 6, 177, 57, 216, 70, 51, 149, 244, 157, 153, 106, 123, 2, 64, 127, 92, 254, 48, 67, 80, 54, 102, 50, 240, 253, 19, 108, 59, 168, 1, 230, 239, 39, 171, 180, 102, 138, 132, 89, 247, 147, 230, 234, 252, 52, 159, 222, 215, 184, 85, 78, 52, 81, 13, 145, 218, 202, 127, 37, 97, 54, 205, 249, 39, 230, 143, 171, 112, 114, 11, 64, 91, 89, 176, 6, 7, 248, 217, 2, 65, 0, 220, 94, 95, 132, 29, 4, 132, 22, 247, 38, 185, 189, 125, 27, 66, 87, 55, 162, 73, 24, 238, 80, 99, 228, 37, 224, 234, 244, 141, 185, 26, 20, 101, 231, 92, 99, 192, 166, 212, 17, 112, 1, 158, 173, 190, 170, 154, 41, 195, 109, 130, 98, 109, 28, 35, 142, 205, 213, 152, 158, 19, 253, 30, 241, 2, 64, 15, 148, 8, 16, 189, 122, 55, 109, 203, 175, 173, 24, 222, 36, 130, 130, 179, 87, 189, 32, 141, 149, 30, 115, 211, 227, 79, 234, 78, 202, 253, 48, 173, 95, 167, 203, 20, 193, 160, 30, 146, 33, 109, 4, 221, 25, 212, 216, 183, 100, 18, 46, 184, 52, 65, 146, 249, 68, 225, 10, 84, 38, 98, 133])
|
pkcs8: 'new Uint8Array([48, 130, 2, 118, 2, 1, 0, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 4, 130, 2, 96, 48, 130, 2, 92, 2, 1, 0, 2, 129, 129, 0, 217, 78, 147, 218, 221, 152, 10, 66, 75, 127, 242, 108, 182, 142, 157, 44, 93, 58, 176, 193, 135, 103, 216, 179, 69, 72, 38, 115, 144, 244, 12, 139, 0, 245, 48, 115, 204, 234, 158, 193, 231, 127, 178, 240, 244, 203, 35, 229, 203, 245, 110, 215, 199, 19, 98, 183, 164, 223, 159, 203, 128, 123, 173, 26, 12, 172, 250, 99, 254, 35, 225, 221, 39, 51, 62, 3, 139, 35, 38, 164, 71, 238, 240, 73, 139, 214, 68, 172, 204, 253, 171, 244, 14, 186, 152, 159, 225, 133, 229, 140, 99, 50, 183, 242, 217, 248, 86, 233, 20, 117, 42, 136, 55, 8, 65, 124, 244, 65, 29, 15, 194, 255, 78, 31, 189, 146, 105, 161, 2, 3, 1, 0, 1, 2, 129, 128, 26, 88, 13, 82, 166, 52, 141, 97, 214, 23, 79, 195, 96, 42, 79, 225, 149, 247, 204, 127, 217, 179, 124, 48, 215, 128, 84, 177, 3, 236, 162, 44, 163, 212, 21, 168, 164, 57, 249, 63, 22, 154, 131, 141, 244, 143, 63, 237, 214, 217, 13, 51, 249, 125, 95, 37, 86, 70, 137, 239, 184, 198, 197, 136, 62, 183, 41, 78, 118, 234, 57, 195, 161, 219, 173, 234, 61, 11, 165, 109, 209, 9, 3, 22, 186, 114, 32, 135, 147, 74, 6, 106, 190, 214, 36, 208, 32, 220, 61, 12, 41, 105, 251, 247, 18, 159, 3, 198, 28, 228, 36, 44, 189, 125, 45, 72, 233, 199, 12, 72, 91, 106, 165, 246, 217, 58, 168, 53, 2, 65, 0, 241, 112, 53, 166, 98, 11, 38, 73, 58, 156, 84, 190, 118, 74, 247, 229, 85, 178, 83, 231, 53, 137, 237, 228, 246, 12, 32, 206, 157, 198, 152, 70, 11, 185, 234, 30, 112, 23, 115, 249, 68, 176, 159, 108, 247, 249, 207, 152, 145, 166, 246, 79, 176, 219, 163, 111, 243, 4, 49, 3, 239, 242, 63, 147, 2, 65, 0, 230, 105, 200, 1, 208, 201, 237, 225, 85, 27, 39, 216, 193, 1, 253, 168, 88, 15, 242, 166, 70, 106, 235, 2, 92, 24, 130, 66, 176, 176, 220, 238, 66, 12, 159, 26, 24, 40, 19, 213, 138, 98, 238, 98, 220, 65, 148, 116, 146, 21, 0, 25, 6, 177, 57, 216, 70, 51, 149, 244, 157, 153, 106, 123, 2, 64, 127, 92, 254, 48, 67, 80, 54, 102, 50, 240, 253, 19, 108, 59, 168, 1, 230, 239, 39, 171, 180, 102, 138, 132, 89, 247, 147, 230, 234, 252, 52, 159, 222, 215, 184, 85, 78, 52, 81, 13, 145, 218, 202, 127, 37, 97, 54, 205, 249, 39, 230, 143, 171, 112, 114, 11, 64, 91, 89, 176, 6, 7, 248, 217, 2, 65, 0, 220, 94, 95, 132, 29, 4, 132, 22, 247, 38, 185, 189, 125, 27, 66, 87, 55, 162, 73, 24, 238, 80, 99, 228, 37, 224, 234, 244, 141, 185, 26, 20, 101, 231, 92, 99, 192, 166, 212, 17, 112, 1, 158, 173, 190, 170, 154, 41, 195, 109, 130, 98, 109, 28, 35, 142, 205, 213, 152, 158, 19, 253, 30, 241, 2, 64, 15, 148, 8, 16, 189, 122, 55, 109, 203, 175, 173, 24, 222, 36, 130, 130, 179, 87, 189, 32, 141, 149, 30, 115, 211, 227, 79, 234, 78, 202, 253, 48, 173, 95, 167, 203, 20, 193, 160, 30, 146, 33, 109, 4, 221, 25, 212, 216, 183, 100, 18, 46, 184, 52, 65, 146, 249, 68, 225, 10, 84, 38, 98, 133])'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'ECDSA': {
|
'ECDSA': {
|
||||||
|
@ -363,19 +360,19 @@ make.crypto = {
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
len = this.length(len)
|
len = this.length(len)
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'ECDSA',
|
name: 'ECDSA',
|
||||||
namedCurve: `P-${len}`,
|
namedCurve: 'P-${len}',
|
||||||
hash: {
|
hash: {
|
||||||
name: `SHA-${len}`
|
name: 'SHA-${len}'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'EC',
|
kty: 'EC',
|
||||||
alg: `ES${this.length(len)}`
|
alg: 'ES${this.length(len)}'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -408,8 +405,8 @@ make.crypto = {
|
||||||
ext: true
|
ext: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
spki: new Uint8Array([48, 89, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 3, 66, 0, 4, 3, 151, 208, 156, 23, 65, 74, 0, 97, 78, 51, 43, 212, 11, 105, 206, 248, 121, 72, 166, 16, 225, 164, 17, 39, 213, 147, 8, 110, 84, 226, 110, 241, 129, 125, 241, 188, 179, 50, 88, 199, 95, 116, 249, 57, 18, 216, 76, 54, 220, 192, 111, 191, 122, 173, 223, 219, 114, 109, 76, 78, 165, 57, 237]),
|
spki: 'new Uint8Array([48, 89, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 3, 66, 0, 4, 3, 151, 208, 156, 23, 65, 74, 0, 97, 78, 51, 43, 212, 11, 105, 206, 248, 121, 72, 166, 16, 225, 164, 17, 39, 213, 147, 8, 110, 84, 226, 110, 241, 129, 125, 241, 188, 179, 50, 88, 199, 95, 116, 249, 57, 18, 216, 76, 54, 220, 192, 111, 191, 122, 173, 223, 219, 114, 109, 76, 78, 165, 57, 237])',
|
||||||
pkcs8: new Uint8Array([48, 129, 135, 2, 1, 0, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 4, 109, 48, 107, 2, 1, 1, 4, 32, 224, 59, 194, 250, 28, 105, 191, 201, 178, 100, 179, 94, 49, 143, 188, 158, 174, 121, 50, 23, 95, 3, 138, 27, 51, 89, 70, 27, 120, 69, 255, 42, 161, 68, 3, 66, 0, 4, 3, 151, 208, 156, 23, 65, 74, 0, 97, 78, 51, 43, 212, 11, 105, 206, 248, 121, 72, 166, 16, 225, 164, 17, 39, 213, 147, 8, 110, 84, 226, 110, 241, 129, 125, 241, 188, 179, 50, 88, 199, 95, 116, 249, 57, 18, 216, 76, 54, 220, 192, 111, 191, 122, 173, 223, 219, 114, 109, 76, 78, 165, 57, 237])
|
pkcs8: 'new Uint8Array([48, 129, 135, 2, 1, 0, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 4, 109, 48, 107, 2, 1, 1, 4, 32, 224, 59, 194, 250, 28, 105, 191, 201, 178, 100, 179, 94, 49, 143, 188, 158, 174, 121, 50, 23, 95, 3, 138, 27, 51, 89, 70, 27, 120, 69, 255, 42, 161, 68, 3, 66, 0, 4, 3, 151, 208, 156, 23, 65, 74, 0, 97, 78, 51, 43, 212, 11, 105, 206, 248, 121, 72, 166, 16, 225, 164, 17, 39, 213, 147, 8, 110, 84, 226, 110, 241, 129, 125, 241, 188, 179, 50, 88, 199, 95, 116, 249, 57, 18, 216, 76, 54, 220, 192, 111, 191, 122, 173, 223, 219, 114, 109, 76, 78, 165, 57, 237])'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'ECDH': {
|
'ECDH': {
|
||||||
|
@ -418,11 +415,10 @@ make.crypto = {
|
||||||
return len || random.item([256, 384, 512])
|
return len || random.item([256, 384, 512])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
len = this.length(len)
|
return utils.common.mockup(`{
|
||||||
return {
|
|
||||||
name: 'ECDSA',
|
name: 'ECDSA',
|
||||||
namedCurve: `P-${len}`
|
namedCurve: 'P-${this.length(len)}'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function () {
|
jwk: function () {
|
||||||
return {}
|
return {}
|
||||||
|
@ -434,16 +430,18 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
deriveKey: function (key) {
|
deriveKey: function (key) {
|
||||||
return Object.assign(
|
return utils.common.mockup(`{
|
||||||
this.alg(),
|
name: 'ECDSA',
|
||||||
key
|
namedCurve: 'P-${this.length()}',
|
||||||
)
|
${key}
|
||||||
|
}`)
|
||||||
},
|
},
|
||||||
deriveBits: function (key) {
|
deriveBits: function (key) {
|
||||||
return Object.assign(
|
return utils.common.mockup(`{
|
||||||
this.alg(),
|
name: 'ECDSA',
|
||||||
key
|
namedCurve: 'P-${this.length()}',
|
||||||
)
|
${key}
|
||||||
|
}`)
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: {},
|
raw: {},
|
||||||
|
@ -464,8 +462,8 @@ make.crypto = {
|
||||||
ext: true
|
ext: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
spki: new Uint8Array([48, 89, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 3, 66, 0, 4, 146, 4, 127, 62, 163, 180, 236, 191, 44, 100, 224, 91, 195, 170, 239, 191, 179, 191, 127, 183, 37, 168, 55, 162, 19, 117, 167, 50, 70, 249, 18, 130, 118, 50, 62, 94, 160, 170, 75, 35, 189, 24, 89, 63, 65, 63, 236, 181, 19, 140, 8, 4, 78, 34, 245, 60, 40, 227, 145, 6, 4, 20, 122, 97]),
|
spki: 'new Uint8Array([48, 89, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 3, 66, 0, 4, 146, 4, 127, 62, 163, 180, 236, 191, 44, 100, 224, 91, 195, 170, 239, 191, 179, 191, 127, 183, 37, 168, 55, 162, 19, 117, 167, 50, 70, 249, 18, 130, 118, 50, 62, 94, 160, 170, 75, 35, 189, 24, 89, 63, 65, 63, 236, 181, 19, 140, 8, 4, 78, 34, 245, 60, 40, 227, 145, 6, 4, 20, 122, 97])',
|
||||||
pkcs8: new Uint8Array([48, 129, 135, 2, 1, 0, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 4, 109, 48, 107, 2, 1, 1, 4, 32, 229, 163, 197, 74, 221, 20, 21, 85, 216, 26, 239, 153, 43, 32, 189, 21, 2, 20, 56, 3, 38, 158, 60, 221, 35, 9, 49, 8, 199, 183, 34, 137, 161, 68, 3, 66, 0, 4, 146, 4, 127, 62, 163, 180, 236, 191, 44, 100, 224, 91, 195, 170, 239, 191, 179, 191, 127, 183, 37, 168, 55, 162, 19, 117, 167, 50, 70, 249, 18, 130, 118, 50, 62, 94, 160, 170, 75, 35, 189, 24, 89, 63, 65, 63, 236, 181, 19, 140, 8, 4, 78, 34, 245, 60, 40, 227, 145, 6, 4, 20, 122, 97])
|
pkcs8: 'new Uint8Array([48, 129, 135, 2, 1, 0, 48, 19, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, 72, 206, 61, 3, 1, 7, 4, 109, 48, 107, 2, 1, 1, 4, 32, 229, 163, 197, 74, 221, 20, 21, 85, 216, 26, 239, 153, 43, 32, 189, 21, 2, 20, 56, 3, 38, 158, 60, 221, 35, 9, 49, 8, 199, 183, 34, 137, 161, 68, 3, 66, 0, 4, 146, 4, 127, 62, 163, 180, 236, 191, 44, 100, 224, 91, 195, 170, 239, 191, 179, 191, 127, 183, 37, 168, 55, 162, 19, 117, 167, 50, 70, 249, 18, 130, 118, 50, 62, 94, 160, 170, 75, 35, 189, 24, 89, 63, 65, 63, 236, 181, 19, 140, 8, 4, 78, 34, 245, 60, 40, 227, 145, 6, 4, 20, 122, 97])'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'AES-CTR': {
|
'AES-CTR': {
|
||||||
|
@ -475,16 +473,16 @@ make.crypto = {
|
||||||
return len || random.item([128, 192, 256])
|
return len || random.item([128, 192, 256])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'AES-CTR',
|
name: 'AES-CTR',
|
||||||
length: this.length(len)
|
length: '${this.length(len)}'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
alg: `A${this.length(len)}CTR`
|
alg: 'A${this.length(len)}CTR'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -493,12 +491,11 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
encrypt: function () {
|
encrypt: function () {
|
||||||
return Object.assign(
|
return utils.common.mockup(`{
|
||||||
this.alg(),
|
name: 'AES-CTR',
|
||||||
{
|
length: ${this.length()},
|
||||||
counter: new Uint8Array(16)
|
counter: new Uint8Array(16)
|
||||||
}
|
}`)
|
||||||
)
|
|
||||||
},
|
},
|
||||||
decrypt: function () {
|
decrypt: function () {
|
||||||
return this.encrypt()
|
return this.encrypt()
|
||||||
|
@ -510,7 +507,7 @@ make.crypto = {
|
||||||
return this.encrypt()
|
return this.encrypt()
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51]),
|
raw: 'new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51])',
|
||||||
jwk: [
|
jwk: [
|
||||||
{
|
{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
|
@ -530,16 +527,16 @@ make.crypto = {
|
||||||
return len || random.item([128, 192, 256])
|
return len || random.item([128, 192, 256])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'AES-CBC',
|
name: 'AES-CBC',
|
||||||
length: this.length(len)
|
length: ${this.length(len)}
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
alg: `A${this.length(len)}CBC`
|
alg: 'A${this.length(len)}CBC'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -548,31 +545,23 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
encrypt: function () {
|
encrypt: function () {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'AES-CBC',
|
name: 'AES-CBC',
|
||||||
|
length: ${this.length()},
|
||||||
iv: crypto.getRandomValues(new Uint8Array(16))
|
iv: crypto.getRandomValues(new Uint8Array(16))
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
decrypt: function () {
|
decrypt: function () {
|
||||||
return {
|
return this.encrypt()
|
||||||
name: 'AES-CBC',
|
|
||||||
iv: crypto.getRandomValues(new Uint8Array(16))
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
wrapKey: function () {
|
wrapKey: function () {
|
||||||
return {
|
return this.encrypt()
|
||||||
name: 'AES-CBC',
|
|
||||||
iv: crypto.getRandomValues(new Uint8Array(16))
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
unwrapKey: function () {
|
unwrapKey: function () {
|
||||||
return {
|
return this.encrypt()
|
||||||
name: 'AES-CBC',
|
|
||||||
iv: crypto.getRandomValues(new Uint8Array(16))
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51]),
|
raw: 'new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51])',
|
||||||
jwk: [
|
jwk: [
|
||||||
{
|
{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
|
@ -592,22 +581,22 @@ make.crypto = {
|
||||||
return len || random.item([128, 192, 256])
|
return len || random.item([128, 192, 256])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'AES-GCM',
|
name: 'AES-GCM',
|
||||||
length: this.length(len)
|
length: ${this.length(len)}
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
if (random.number(2) === 0) {
|
if (random.chance(4)) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
alg: `A${this.length(len)}GCM`
|
alg: 'A${this.length(len)}GCMKW'
|
||||||
}
|
}`)
|
||||||
} else {
|
} else {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
alg: `A${this.length(len)}GCMKW`
|
alg: 'A${this.length(len)}GCM'
|
||||||
}
|
}`)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
|
@ -617,27 +606,27 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
encrypt: function () {
|
encrypt: function () {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'AES-GCM',
|
name: 'AES-GCM',
|
||||||
iv: crypto.getRandomValues(new Uint8Array(12)),
|
iv: crypto.getRandomValues(new Uint8Array(12)),
|
||||||
additionalData: crypto.getRandomValues(new Uint8Array(256)),
|
additionalData: crypto.getRandomValues(new Uint8Array(256)),
|
||||||
tagLength: random.item([32, 64, 96, 104, 112, 120, 128])
|
tagLength: ${random.item([32, 64, 96, 104, 112, 120, 128])}
|
||||||
}
|
}`)
|
||||||
|
},
|
||||||
|
decrypt: function () {
|
||||||
|
return this.encrypt()
|
||||||
},
|
},
|
||||||
wrapKey: function () {
|
wrapKey: function () {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'AES-GCM',
|
name: 'AES-GCM',
|
||||||
iv: crypto.getRandomValues(new Uint8Array(16))
|
iv: crypto.getRandomValues(new Uint8Array(16))
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
unwrapKey: function () {
|
unwrapKey: function () {
|
||||||
return {
|
return this.wrapKey()
|
||||||
name: 'AES-GCM',
|
|
||||||
iv: crypto.getRandomValues(new Uint8Array(16))
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51]),
|
raw: 'new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51])',
|
||||||
jwk: [
|
jwk: [
|
||||||
{
|
{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
|
@ -657,16 +646,16 @@ make.crypto = {
|
||||||
return len || random.item([128, 192, 256])
|
return len || random.item([128, 192, 256])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'AES-KW',
|
name: 'AES-KW',
|
||||||
length: this.length(len)
|
length: ${this.length(len)}
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
alg: `A${this.length(len)}KW`
|
alg: 'A${this.length(len)}KW'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -675,17 +664,15 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
wrapKey: function () {
|
wrapKey: function () {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'AES-KW'
|
name: 'AES-KW'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
unwrapKey: function () {
|
unwrapKey: function () {
|
||||||
return {
|
return this.wrapKey()
|
||||||
name: 'AES-KW'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51]),
|
raw: 'new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51])',
|
||||||
jwk: [
|
jwk: [
|
||||||
{
|
{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
|
@ -705,18 +692,18 @@ make.crypto = {
|
||||||
return len || random.item([1, 256, 384, 512])
|
return len || random.item([1, 256, 384, 512])
|
||||||
},
|
},
|
||||||
alg: function (len) {
|
alg: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'HMAC',
|
name: 'HMAC',
|
||||||
hash: {
|
hash: {
|
||||||
name: `SHA-${this.length(len)}`
|
name: 'SHA-${this.length(len)}'
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function (len) {
|
jwk: function (len) {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
alg: `HS${this.length(len)}`
|
alg: 'HS${this.length(len)}'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -731,7 +718,7 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51]),
|
raw: 'new Uint8Array([122, 94, 39, 230, 46, 23, 151, 80, 131, 230, 3, 101, 80, 234, 143, 9, 251, 152, 229, 228, 89, 222, 31, 135, 214, 104, 55, 68, 67, 59, 5, 51])',
|
||||||
jwk: {
|
jwk: {
|
||||||
kty: 'oct',
|
kty: 'oct',
|
||||||
k: 'KfKY5nueRX7eBrOddn9IerHLv1r-T7qpggaCF3MfSR4',
|
k: 'KfKY5nueRX7eBrOddn9IerHLv1r-T7qpggaCF3MfSR4',
|
||||||
|
@ -746,12 +733,12 @@ make.crypto = {
|
||||||
// Key derivation using the extraction-then-expansion approach and using the SHA hash functions.
|
// Key derivation using the extraction-then-expansion approach and using the SHA hash functions.
|
||||||
keyUsages: ['deriveKey', 'deriveBits'],
|
keyUsages: ['deriveKey', 'deriveBits'],
|
||||||
alg: function () {
|
alg: function () {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'HKDF'
|
name: 'HKDF'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function () {
|
jwk: function () {
|
||||||
return {}
|
return utils.common.mockup(`{}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -760,35 +747,35 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
deriveBits: function () {
|
deriveBits: function () {
|
||||||
return Object.assign(
|
return utils.common.mockup(`{
|
||||||
this.alg(),
|
name: 'HKDF',
|
||||||
{
|
|
||||||
hash: {
|
hash: {
|
||||||
name: make.crypto.randomDigestName()
|
name: '${make.crypto.randomDigestName()}'
|
||||||
},
|
},
|
||||||
salt: crypto.getRandomValues(new Uint8Array(16)),
|
salt: crypto.getRandomValues(new Uint8Array(16)),
|
||||||
info: crypto.getRandomValues(new Uint8Array(16))
|
info: crypto.getRandomValues(new Uint8Array(16))
|
||||||
}
|
}`)
|
||||||
)
|
|
||||||
},
|
},
|
||||||
deriveKey: function () {
|
deriveKey: function () {
|
||||||
return this.deriveBits()
|
return this.deriveBits()
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: crypto.getRandomValues(new Uint8Array(16))
|
raw: 'crypto.getRandomValues(new Uint8Array(16))',
|
||||||
|
jwk: {},
|
||||||
|
spki: {},
|
||||||
|
pkcs8: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'PBKDF2': {
|
'PBKDF2': {
|
||||||
// Key derivation using the PKCS#5 password-based key derivation function v2.0.
|
// Key derivation using the PKCS#5 password-based key derivation function v2.0.
|
||||||
keyUsages: ['deriveKey', 'deriveBits'],
|
keyUsages: ['deriveKey', 'deriveBits'],
|
||||||
alg: function () {
|
alg: function () {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'PBKDF2'
|
name: 'PBKDF2'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function () {
|
jwk: function () {
|
||||||
return {
|
return utils.common.mockup(`{}`)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
|
@ -797,22 +784,20 @@ make.crypto = {
|
||||||
return this.alg()
|
return this.alg()
|
||||||
},
|
},
|
||||||
deriveBits: function () {
|
deriveBits: function () {
|
||||||
return Object.assign(
|
return utils.common.mockup(`{
|
||||||
this.alg(),
|
name: 'PBKDF2',
|
||||||
{
|
|
||||||
hash: {
|
hash: {
|
||||||
name: make.crypto.randomDigestName()
|
name: '${make.crypto.randomDigestName()}'
|
||||||
},
|
},
|
||||||
salt: crypto.getRandomValues(new Uint8Array(16)),
|
salt: crypto.getRandomValues(new Uint8Array(16)),
|
||||||
iterations: random.number(1000)
|
iterations: ${random.number(1000)}
|
||||||
}
|
}`)
|
||||||
)
|
|
||||||
},
|
},
|
||||||
deriveKey: function () {
|
deriveKey: function () {
|
||||||
return this.deriveBits()
|
return this.deriveBits()
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: crypto.getRandomValues(new Uint8Array(16)),
|
raw: 'crypto.getRandomValues(new Uint8Array(16))',
|
||||||
jwk: {},
|
jwk: {},
|
||||||
spki: {},
|
spki: {},
|
||||||
pkcs8: {}
|
pkcs8: {}
|
||||||
|
@ -821,36 +806,39 @@ make.crypto = {
|
||||||
'DH': {
|
'DH': {
|
||||||
keyUsages: ['deriveKey', 'deriveBits'],
|
keyUsages: ['deriveKey', 'deriveBits'],
|
||||||
alg: function () {
|
alg: function () {
|
||||||
return {
|
return utils.common.mockup(`{
|
||||||
name: 'DH'
|
name: 'DH'
|
||||||
}
|
}`)
|
||||||
},
|
},
|
||||||
jwk: function () {
|
jwk: function () {
|
||||||
return {}
|
return utils.common.mockup(`{}`)
|
||||||
},
|
},
|
||||||
generateKey: function () {
|
generateKey: function () {
|
||||||
return Object.assign(
|
return utils.common.mockup(`{
|
||||||
this.alg(),
|
name: 'DH',
|
||||||
{
|
|
||||||
prime: new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255, 201, 15, 218, 162, 33, 104, 194, 52, 196, 198, 98, 139, 128, 220, 28, 209, 41, 2, 78, 8, 138, 103, 204, 116, 2, 11, 190, 166, 59, 19, 155, 34, 81, 74, 8, 121, 142, 52, 4, 221, 239, 149, 25, 179, 205, 58, 67, 27, 48, 43, 10, 109, 242, 95, 20, 55, 79, 225, 53, 109, 109, 81, 194, 69, 228, 133, 181, 118, 98, 94, 126, 198, 244, 76, 66, 233, 166, 55, 237, 107, 11, 255, 92, 182, 244, 6, 183, 237, 238, 56, 107, 251, 90, 137, 159, 165, 174, 159, 36, 17, 124, 75, 31, 230, 73, 40, 102, 81, 236, 228, 91, 61, 194, 0, 124, 184, 161, 99, 191, 5, 152, 218, 72, 54, 28, 85, 211, 154, 105, 22, 63, 168, 253, 36, 207, 95, 131, 101, 93, 35, 220, 163, 173, 150, 28, 98, 243, 86, 32, 133, 82, 187, 158, 213, 41, 7, 112, 150, 150, 109, 103, 12, 53, 78, 74, 188, 152, 4, 241, 116, 108, 8, 202, 35, 115, 39, 255, 255, 255, 255, 255, 255, 255, 255]),
|
prime: new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255, 201, 15, 218, 162, 33, 104, 194, 52, 196, 198, 98, 139, 128, 220, 28, 209, 41, 2, 78, 8, 138, 103, 204, 116, 2, 11, 190, 166, 59, 19, 155, 34, 81, 74, 8, 121, 142, 52, 4, 221, 239, 149, 25, 179, 205, 58, 67, 27, 48, 43, 10, 109, 242, 95, 20, 55, 79, 225, 53, 109, 109, 81, 194, 69, 228, 133, 181, 118, 98, 94, 126, 198, 244, 76, 66, 233, 166, 55, 237, 107, 11, 255, 92, 182, 244, 6, 183, 237, 238, 56, 107, 251, 90, 137, 159, 165, 174, 159, 36, 17, 124, 75, 31, 230, 73, 40, 102, 81, 236, 228, 91, 61, 194, 0, 124, 184, 161, 99, 191, 5, 152, 218, 72, 54, 28, 85, 211, 154, 105, 22, 63, 168, 253, 36, 207, 95, 131, 101, 93, 35, 220, 163, 173, 150, 28, 98, 243, 86, 32, 133, 82, 187, 158, 213, 41, 7, 112, 150, 150, 109, 103, 12, 53, 78, 74, 188, 152, 4, 241, 116, 108, 8, 202, 35, 115, 39, 255, 255, 255, 255, 255, 255, 255, 255]),
|
||||||
generator: new Uint8Array([2])
|
generator: new Uint8Array([2])
|
||||||
}
|
}`)
|
||||||
)
|
|
||||||
},
|
},
|
||||||
importKey: function () {
|
importKey: function () {
|
||||||
return this.generateKey()
|
return this.generateKey()
|
||||||
},
|
},
|
||||||
deriveKey: function (key) {
|
deriveKey: function (key) {
|
||||||
return Object.assign(
|
// return Object.assign(this.generateKey(),key)
|
||||||
this.generateKey(),
|
return utils.common.mockup(`
|
||||||
key
|
name: 'DH',
|
||||||
)
|
prime: new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255, 201, 15, 218, 162, 33, 104, 194, 52, 196, 198, 98, 139, 128, 220, 28, 209, 41, 2, 78, 8, 138, 103, 204, 116, 2, 11, 190, 166, 59, 19, 155, 34, 81, 74, 8, 121, 142, 52, 4, 221, 239, 149, 25, 179, 205, 58, 67, 27, 48, 43, 10, 109, 242, 95, 20, 55, 79, 225, 53, 109, 109, 81, 194, 69, 228, 133, 181, 118, 98, 94, 126, 198, 244, 76, 66, 233, 166, 55, 237, 107, 11, 255, 92, 182, 244, 6, 183, 237, 238, 56, 107, 251, 90, 137, 159, 165, 174, 159, 36, 17, 124, 75, 31, 230, 73, 40, 102, 81, 236, 228, 91, 61, 194, 0, 124, 184, 161, 99, 191, 5, 152, 218, 72, 54, 28, 85, 211, 154, 105, 22, 63, 168, 253, 36, 207, 95, 131, 101, 93, 35, 220, 163, 173, 150, 28, 98, 243, 86, 32, 133, 82, 187, 158, 213, 41, 7, 112, 150, 150, 109, 103, 12, 53, 78, 74, 188, 152, 4, 241, 116, 108, 8, 202, 35, 115, 39, 255, 255, 255, 255, 255, 255, 255, 255]),
|
||||||
|
generator: new Uint8Array([2]),
|
||||||
|
${key}
|
||||||
|
`)
|
||||||
},
|
},
|
||||||
deriveBits: function (key) {
|
deriveBits: function (key) {
|
||||||
return Object.assign(
|
return utils.common.mockup(`
|
||||||
this.generateKey(),
|
name: 'DH',
|
||||||
key
|
prime: new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255, 201, 15, 218, 162, 33, 104, 194, 52, 196, 198, 98, 139, 128, 220, 28, 209, 41, 2, 78, 8, 138, 103, 204, 116, 2, 11, 190, 166, 59, 19, 155, 34, 81, 74, 8, 121, 142, 52, 4, 221, 239, 149, 25, 179, 205, 58, 67, 27, 48, 43, 10, 109, 242, 95, 20, 55, 79, 225, 53, 109, 109, 81, 194, 69, 228, 133, 181, 118, 98, 94, 126, 198, 244, 76, 66, 233, 166, 55, 237, 107, 11, 255, 92, 182, 244, 6, 183, 237, 238, 56, 107, 251, 90, 137, 159, 165, 174, 159, 36, 17, 124, 75, 31, 230, 73, 40, 102, 81, 236, 228, 91, 61, 194, 0, 124, 184, 161, 99, 191, 5, 152, 218, 72, 54, 28, 85, 211, 154, 105, 22, 63, 168, 253, 36, 207, 95, 131, 101, 93, 35, 220, 163, 173, 150, 28, 98, 243, 86, 32, 133, 82, 187, 158, 213, 41, 7, 112, 150, 150, 109, 103, 12, 53, 78, 74, 188, 152, 4, 241, 116, 108, 8, 202, 35, 115, 39, 255, 255, 255, 255, 255, 255, 255, 255]),
|
||||||
)
|
generator: new Uint8Array([2]),
|
||||||
|
${key}
|
||||||
|
`)
|
||||||
},
|
},
|
||||||
presets: {
|
presets: {
|
||||||
raw: {},
|
raw: {},
|
||||||
|
@ -860,10 +848,12 @@ make.crypto = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
supportedAlgorithms: () => Object.keys(make.crypto.algorithms),
|
||||||
randomAlgorithm: () => {
|
randomAlgorithm: () => {
|
||||||
return make.crypto.algorithms[random.item(Object.keys(make.crypto.algorithms))]
|
return make.crypto.algorithms[random.item(Object.keys(make.crypto.algorithms))]
|
||||||
},
|
},
|
||||||
getRandomCandidate: (alg) => {
|
randomCandidate: (operation) => {
|
||||||
return make.crypto.randomAlgorithm(make.crypto.algorithmNames[random.item(alg.keyUsages)])
|
// Find and return a random algorithm suitable for a given operation.
|
||||||
|
return make.crypto.algorithms[make.crypto.randomAlgorithmName(operation)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue