MCPcopy Create free account
hub / github.com/apache/cloudstack / decrypt

Method decrypt

systemvm/agent/noVNC/core/crypto/rsa.js:104–124  ·  view source on GitHub ↗
(_algorithm, message)

Source from the content-addressed store, hash-verified

102 }
103
104 async decrypt(_algorithm, message) {
105 if (message.length !== this._keyBytes) {
106 return null;
107 }
108 const msgBigInt = u8ArrayToBigInt(message);
109 const emBigInt = modPow(msgBigInt, this._dBigInt, this._nBigInt);
110 const em = bigIntToU8Array(emBigInt, this._keyBytes);
111 if (em[0] !== 0x00 || em[1] !== 0x02) {
112 return null;
113 }
114 let i = 2;
115 for (; i < em.length; i++) {
116 if (em[i] === 0x00) {
117 break;
118 }
119 }
120 if (i === em.length) {
121 return null;
122 }
123 return em.slice(i + 1, em.length);
124 }
125
126 async exportKey() {
127 if (!this._extractable) {

Callers

nothing calls this directly

Calls 4

u8ArrayToBigIntFunction · 0.90
modPowFunction · 0.90
bigIntToU8ArrayFunction · 0.90
sliceMethod · 0.80

Tested by

no test coverage detected