cipher.spec.js 977 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright 2018 Scytl Secure Electronic Voting SA
  3. *
  4. * All rights reserved
  5. *
  6. * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
  7. */
  8. /* global forge */
  9. /* global CL */
  10. /* global OV */
  11. /* global TD */
  12. describe('Cipher api', function() {
  13. 'use strict';
  14. var TD = require('./mocks/testdata.json');
  15. it('should cipher an array of elements', function() {
  16. var encParms = OV.parseEncryptionParams(TD.authResponse);
  17. var serializedEncrypterValues = OV.precomputeEncrypterValues(encParms);
  18. var encrypterValues = OV.deserializeEncrypterValues(serializedEncrypterValues);
  19. var keyValue = forge.jsbn.BigInteger.ONE;
  20. var element = new CL.commons.mathematical.ZpGroupElement(keyValue, encParms.p, encParms.q);
  21. var messages = [element];
  22. var ciphered = OV.encryptOptions(messages, encParms, encrypterValues);
  23. expect(ciphered).toBeDefined();
  24. });
  25. });