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

Method _importKey

systemvm/agent/noVNC/core/crypto/rsa.js:69–84  ·  view source on GitHub ↗
(key, extractable)

Source from the content-addressed store, hash-verified

67 }
68
69 async _importKey(key, extractable) {
70 const n = key.n;
71 const e = key.e;
72 if (n.length !== e.length) {
73 throw new Error("the sizes of modulus and public exponent do not match");
74 }
75 this._keyBytes = n.length;
76 this._keyLength = this._keyBytes * 8;
77 this._n = new Uint8Array(this._keyBytes);
78 this._e = new Uint8Array(this._keyBytes);
79 this._n.set(n);
80 this._e.set(e);
81 this._nBigInt = u8ArrayToBigInt(this._n);
82 this._eBigInt = u8ArrayToBigInt(this._e);
83 this._extractable = extractable;
84 }
85
86 async encrypt(_algorithm, message) {
87 if (message.length > this._keyBytes - 11) {

Callers 1

importKeyMethod · 0.95

Calls 2

u8ArrayToBigIntFunction · 0.90
setMethod · 0.65

Tested by

no test coverage detected