1 /* gpgme.js - Javascript integration for gpgme
2 * Copyright (C) 2018 Bundesamt für Sicherheit in der Informationstechnik
4 * This file is part of GPGME.
6 * GPGME is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * GPGME is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
18 * SPDX-License-Identifier: LGPL-2.1+
21 * Maximilian Krambach <mkrambach@intevation.de>
24 /* global describe, it, expect, before, Gpgmejs */
25 /* global bigString, inputvalues */
27 describe('Signing', function () {
29 const good_fpr = inputvalues.encrypt.good.fingerprint;
31 before(function (done){
32 const prm = Gpgmejs.init({ timeout: 2000 });
33 prm.then(function (gpgmejs){
39 it('Sign a message', function (done) {
40 const data = bigString(100);
41 context.sign({ data: data, keys: good_fpr }).then(function (answer) {
42 expect(answer).to.not.be.empty;
43 expect(answer.data).to.be.a('string');
44 expect(answer.data).to.include('BEGIN PGP SIGNATURE');
45 expect(answer.data).to.include('END PGP SIGNATURE');
46 expect(answer.data).to.include(data);
51 it('Detached sign a message', function (done) {
52 const data = bigString(100);
53 context.sign({ data: data, keys: good_fpr, mode: 'detached' })
54 .then(function (answer) {
55 expect(answer).to.not.be.empty;
56 expect(answer.data).to.be.a('string');
57 expect(answer.data).to.include(data);
58 expect(answer.signature).to.be.a('string');
59 expect(answer.signature).to.be.a('string');