|
Packit Service |
30b792 |
/* gpgme.js - Javascript integration for gpgme
|
|
Packit Service |
30b792 |
* Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik
|
|
Packit Service |
30b792 |
*
|
|
Packit Service |
30b792 |
* This file is part of GPGME.
|
|
Packit Service |
30b792 |
*
|
|
Packit Service |
30b792 |
* GPGME is free software; you can redistribute it and/or modify it
|
|
Packit Service |
30b792 |
* under the terms of the GNU Lesser General Public License as
|
|
Packit Service |
30b792 |
* published by the Free Software Foundation; either version 2.1 of
|
|
Packit Service |
30b792 |
* the License, or (at your option) any later version.
|
|
Packit Service |
30b792 |
*
|
|
Packit Service |
30b792 |
* GPGME is distributed in the hope that it will be useful, but
|
|
Packit Service |
30b792 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
30b792 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
30b792 |
* Lesser General Public License for more details.
|
|
Packit Service |
30b792 |
*
|
|
Packit Service |
30b792 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
30b792 |
* License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
Packit Service |
30b792 |
* SPDX-License-Identifier: LGPL-2.1+
|
|
Packit Service |
30b792 |
*
|
|
Packit Service |
30b792 |
* Author(s):
|
|
Packit Service |
30b792 |
* Maximilian Krambach <mkrambach@intevation.de>
|
|
Packit Service |
30b792 |
*/
|
|
Packit Service |
30b792 |
/* global describe, it, before, expect, Gpgmejs */
|
|
Packit Service |
30b792 |
/* global bigString, inputvalues */
|
|
Packit Service |
30b792 |
|
|
Packit Service |
30b792 |
describe('Long running Encryption/Decryption', function () {
|
|
Packit Service |
30b792 |
let context = null;
|
|
Packit Service |
30b792 |
const good_fpr = inputvalues.encrypt.good.fingerprint;
|
|
Packit Service |
30b792 |
before(function (done){
|
|
Packit Service |
30b792 |
const prm = Gpgmejs.init({ timeout: 2000 });
|
|
Packit Service |
30b792 |
prm.then(function (gpgmejs){
|
|
Packit Service |
30b792 |
context = gpgmejs;
|
|
Packit Service |
30b792 |
done();
|
|
Packit Service |
30b792 |
});
|
|
Packit Service |
30b792 |
});
|
|
Packit Service |
30b792 |
|
|
Packit Service |
30b792 |
for (let i=1; i < 101; i++) {
|
|
Packit Service |
30b792 |
it('Successful encrypt/decrypt completely random data '
|
|
Packit Service |
30b792 |
+ (i) + '/100', function (done) {
|
|
Packit Service |
30b792 |
const data = bigString(2*1024*1024);
|
|
Packit Service |
30b792 |
context.encrypt({ data: data, publicKeys: good_fpr })
|
|
Packit Service |
30b792 |
.then(function (answer){
|
|
Packit Service |
30b792 |
expect(answer).to.not.be.empty;
|
|
Packit Service |
30b792 |
expect(answer.data).to.be.a('string');
|
|
Packit Service |
30b792 |
expect(answer.data).to.include('BEGIN PGP MESSAGE');
|
|
Packit Service |
30b792 |
expect(answer.data).to.include('END PGP MESSAGE');
|
|
Packit Service |
30b792 |
context.decrypt({ data: answer.data })
|
|
Packit Service |
30b792 |
.then(function (result){
|
|
Packit Service |
30b792 |
expect(result).to.not.be.empty;
|
|
Packit Service |
30b792 |
expect(result.data).to.be.a('string');
|
|
Packit Service |
30b792 |
expect(result.data).to.equal(data);
|
|
Packit Service |
30b792 |
done();
|
|
Packit Service |
30b792 |
});
|
|
Packit Service |
30b792 |
});
|
|
Packit Service |
30b792 |
}).timeout(15000);
|
|
Packit Service |
30b792 |
}
|
|
Packit Service |
30b792 |
|
|
Packit Service |
30b792 |
});
|