123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- /*
- * Copyright 2018 Scytl Secure Electronic Voting SA
- *
- * All rights reserved
- *
- * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
- */
- /* jshint node:true */
- 'use strict';
- var CommonTestData = require('./common-data');
- var elGamal = require('../../lib/index');
- var mathematical = require('scytl-mathematical');
- module.exports = ValidationTestData;
- /**
- * Provides the input validation data needed by the ElGamal service unit tests.
- */
- function ValidationTestData() {
- var commonTestData = new CommonTestData();
- var nonObject_ = 999;
- var emptyObject_ = {};
- var nonSecureRandomService_ = elGamal.newService();
- var nonSecureRandomGenerator_ = elGamal.newService();
- var nonMathematicalService_ = elGamal.newService();
- var nonBoolean_ = '';
- var nonString_ = 999;
- var nonJsonString_ = 'Not a JSON string';
- var nonArray_ = '';
- var nonStringArray_ = [];
- nonStringArray_.push(1);
- nonStringArray_.push(2);
- nonStringArray_.push(3);
- var nonMathObject_ = elGamal.newService();
- var nonMathObjectArray_ = [];
- nonMathObjectArray_.push(nonMathObject_ + '1');
- nonMathObjectArray_.push(nonMathObject_ + '2');
- nonMathObjectArray_.push(nonMathObject_ + '3');
- var nonElGamalObject_ = mathematical.newService();
- var publicKeyFromAnotherGroup_ = commonTestData.getLargePublicKey();
- var privateKeyFromAnotherGroup_ = commonTestData.getLargePrivateKey();
- var elementsFromAnotherGroup_ =
- commonTestData.getElementsFromLargeZpSubgroup();
- var exponentsFromAnotherGroup_ =
- commonTestData.getExponentsFromLargeZpSubgroup();
- this.getNonObject = function() {
- return nonObject_;
- };
- this.getEmptyObject = function() {
- return emptyObject_;
- };
- this.getNonSecureRandomService = function() {
- return nonSecureRandomService_;
- };
- this.getNonSecureRandomGenerator = function() {
- return nonSecureRandomGenerator_;
- };
- this.getNonMathematicalService = function() {
- return nonMathematicalService_;
- };
- this.getNonBoolean = function() {
- return nonBoolean_;
- };
- this.getNonString = function() {
- return nonString_;
- };
- this.getNonJsonString = function() {
- return nonJsonString_;
- };
- this.getNonArray = function() {
- return nonArray_;
- };
- this.getNonStringArray = function() {
- return nonStringArray_;
- };
- this.getNonMathObject = function() {
- return nonMathObject_;
- };
- this.getNonMathObjectArray = function() {
- return nonMathObjectArray_;
- };
- this.getNonElGamalObject = function() {
- return nonElGamalObject_;
- };
- this.getPublicKeyFromAnotherGroup = function() {
- return publicKeyFromAnotherGroup_;
- };
- this.getPrivateKeyFromAnotherGroup = function() {
- return privateKeyFromAnotherGroup_;
- };
- this.getElementsFromAnotherGroup = function() {
- return elementsFromAnotherGroup_;
- };
- this.getExponentsFromAnotherGroup = function() {
- return exponentsFromAnotherGroup_;
- };
- }
|