mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +03:00
S/MIME allow changing private key passphrase due to #1505
This commit is contained in:
parent
570c7e1a1a
commit
b98b21c1c6
44 changed files with 198 additions and 21 deletions
|
|
@ -42,26 +42,54 @@ export class IdentityPopupView extends AbstractViewPopup {
|
|||
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
|
||||
|
||||
this.createSelfSigned = this.createSelfSigned.bind(this);
|
||||
this.setSMimeKeyPass = this.setSMimeKeyPass.bind(this);
|
||||
}
|
||||
|
||||
async createSelfSigned() {
|
||||
const identity = this.identity(),
|
||||
pass = await AskPopupView.password('', 'CRYPTO/CREATE_SELF_SIGNED');
|
||||
if (pass) {
|
||||
Remote.request('SMimeCreateCertificate', (iError, oData) => {
|
||||
if (oData.Result.x509) {
|
||||
identity.smimeKey(oData.Result.pkey);
|
||||
identity.smimeCertificate(oData.Result.x509);
|
||||
} else {
|
||||
this.submitError(oData.ErrorMessage);
|
||||
}
|
||||
}, {
|
||||
name: identity.name(),
|
||||
email: identity.email(),
|
||||
privateKey: identity.smimeKey(),
|
||||
passphrase: pass.password
|
||||
});
|
||||
createSelfSigned() {
|
||||
AskPopupView.password('', 'CRYPTO/CREATE_SELF_SIGNED').then(pass => {
|
||||
if (pass) {
|
||||
const identity = this.identity();
|
||||
Remote.request('SMimeCreateCertificate', (iError, oData) => {
|
||||
if (oData.Result.x509) {
|
||||
identity.smimeKey(oData.Result.pkey);
|
||||
identity.smimeCertificate(oData.Result.x509);
|
||||
} else {
|
||||
this.submitError(oData.ErrorMessage);
|
||||
}
|
||||
}, {
|
||||
name: identity.name(),
|
||||
email: identity.email(),
|
||||
privateKey: identity.smimeKey(),
|
||||
passphrase: pass.password
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async setSMimeKeyPass() {
|
||||
const identity = this.identity();
|
||||
let old = null
|
||||
if (identity.smimeKeyEncrypted()) {
|
||||
old = await AskPopupView.password(i18n('CRYPTO/CURRENT_PASS'), 'CRYPTO/DECRYPT', 1);
|
||||
if (!old) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
AskPopupView.password(i18n('CRYPTO/NEW_PASS'), 'GLOBAL/SAVE', 1).then(pass => {
|
||||
if (pass) {
|
||||
Remote.request('SMimeExportPrivateKey', (iError, oData) => {
|
||||
if (oData.Result) {
|
||||
identity.smimeKey(oData.Result);
|
||||
} else {
|
||||
this.submitError(oData.ErrorMessage);
|
||||
}
|
||||
}, {
|
||||
privateKey: identity.smimeKey(),
|
||||
oldPassphrase: old?.password,
|
||||
newPassphrase: pass.password
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
submitForm(form) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue