diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0f711b0..6e2c020 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -32,38 +32,6 @@ export class AppComponent { this.textarea = null; } GenerateKeyPair(): void { - window.crypto.subtle.generateKey( - { - name: 'RSA-OAEP', - modulusLength: 4096, // can be 1024, 2048, or 4096 - publicExponent: new Uint8Array([0x01, 0x00, 0x01]), - hash: {name: 'SHA-512'}, // can be "SHA-1", "SHA-256", "SHA-384", or "SHA-512" - }, - true, // whether the key is extractable (i.e. can be used in exportKey) - ['encrypt', 'decrypt'] // must be ["encrypt", "decrypt"] or ["wrapKey", "unwrapKey"] - ) - .then(function(key){ - // returns a keypair object - console.log(key); - console.log(key.publicKey); - console.log(key.privateKey); - window.crypto.subtle.exportKey( - 'jwk', // can be "jwk" (public or private), "spki" (public only), or "pkcs8" (private only) - key.publicKey // can be a publicKey or privateKey, as long as extractable was true - ) - .then(function(keydata){ - // returns the exported key data - console.log(keydata); - }); - window.crypto.subtle.exportKey( - 'pkcs8', // can be "jwk" (public or private), "spki" (public only), or "pkcs8" (private only) - key.privateKey // can be a publicKey or privateKey, as long as extractable was true - ) - .then(function(keydata){ - // returns the exported key data - console.log(new Uint8Array(keydata)); - }); - }); } AcceptNew(): void { console.log(this.textarea); @@ -73,8 +41,6 @@ export class AppComponent { obj.Hash = ''; const body = JSON.stringify(obj); console.log(body); - const dejson = JSON.parse(body); - console.log(dejson); // const headers = new Headers({ 'Content-Type': 'application/json;charset=utf-8' }); // this.http.post((this.address + 'new'), body, { headers: headers }); }