12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130 |
- /*
- * 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
- */
- describe('Asymmetric service...', function() {
- 'use strict';
- describe('should be able to ..', function() {
- var _plaintext = 'Ox2fUJq1gAbX';
- var _privateKeyPem =
- '-----BEGIN RSA PRIVATE KEY-----MIIEowIBAAKCAQEAglypZU45bnf2opnRI+Y51VqouBpvDT33xIB/OtbwKzwVpi+JrjBFtfk33tE9t/dSRs79CK94HRhCWcOiLa2qWPrjeZ9SBiEyScrhIvRZVBF41zBgwQNuRvJCsKmAqlZaFNJDZxEP4repmlBn1CfVFmfrXmOKqwP5F7l9ZtucveRzsfmF1yVPFkW8TMuB3YqMiyymyqHlS8ujCsu5I8tpgPbwuxdMOY94fNhSXrYkY8IuX1g1zdq/Z1jluOaR/UqK4UpnbuJaH/F0VgDNiWh6cTD0DFGEk0b70i5wU4Q3L/S6XZQRvSuADoCbhwBKuFL5pW5n865oLVb5S3wuVdWaGwIDAQABAoIBAC/tn34Wf3kE9BGeGc1oFLVDaqqdVVz5/oEpeR2J7q0GnzMFYUpAhzC7WvY52cYsUPyll1Q9Jx0TUTmteo/uvKWQQFfz4nVMeS+2PoXabolBDzuWlsv/1eiRo0FOYHa/3siu8YcQN9X0DpAkpbfTmT1uoZOHZ3EuucMmOFu7vGn38Grw8bSxpR0uvTtnb8ygC+aB51y38RMyhzQQanrM8FMeAfDAy6IB0Yo7b0c50Cxa6Ax4nqn9LXyGakr5WeAMkgTIOA/GId9SZD4e5eRpq+628pOeR4O9datFltgl6r1+A4ii2VrJsDqeatGtODlX6KRKqwFHoGIa2TjgSZLuorECgYEAxeSZDOOgFsI5mB7RkRzZaQ9znJ15sgdyZiAFZAOUah4hSGdAXNAnZTlrdacduXEu3EfkpuPToX7xZSv5FRYwfBwMwCLeytlGLPjQzWejZGbo4+KqgzWb9fECDYVtDPlJ/+yLih9nt67BHweJKxYydl18rVigdVyy22X86NijSykCgYEAqKPUrXZAo+TJvmTw4tgsibJgvXBYBhmsej8mGNQw+Nyp2gV28sgm61ifIeXKS8teq+MFwGA6cHQedbsCqhMHokdhESZmlbWxhSFLihQcewBxwvrBwbaxI23yXRzwMewznZFL032PpcbqrmwFmcSSEZ3nmbvTH6ShqLW+pzDNp6MCgYBQLzdgxJ7qedqSa/JohTMG4e7rh9d2rpPJE7J7ewPZF8pOpx+qO+Gqn2COdJ+Ts2vUcAETKn9nEaPIZc/wnmQY9dioxbhWo0FPGaaphBPtq9Ez/XUv4zoFppk5V1X/isdUPsmvttf00oeIBiqrXbwmv+yz5JRn2Z7TTXjz9Ev+OQKBgQCUuoCMRzl1EgcXIqEL/0kwW6BUEqufHa9u1Ri9Vw6lvL8T6DPipMEmWK9nzuid9gtVns/ovTVtDgv7GuabplLaPQePf4WDzY11c0rSyS/hDyBFrK+LL5uEOqhAlJAGB2HyOj1clWVF+GvrTpuV5LZKUS/79pmZU7G7QCaX/0Ow7wKBgC/kDH7cmWQnWvvJ5izrx/7PogQVPOLELeUIGLu/hjsSdDKiFCxCUZ948+9NuG+DnpXDWzw//r8mPBRRGGsqFws5Aipp7yjQ3kRDCCzGelPCVhHyfmKqA+8ewXPulKS3/wIyHIvaXmsuAtTfurHtpRyzjKmCBK1Y6WQ3trIXvo7s-----END RSA PRIVATE KEY-----';
- var _publicKeyPem =
- '-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAglypZU45bnf2opnRI+Y51VqouBpvDT33xIB/OtbwKzwVpi+JrjBFtfk33tE9t/dSRs79CK94HRhCWcOiLa2qWPrjeZ9SBiEyScrhIvRZVBF41zBgwQNuRvJCsKmAqlZaFNJDZxEP4repmlBn1CfVFmfrXmOKqwP5F7l9ZtucveRzsfmF1yVPFkW8TMuB3YqMiyymyqHlS8ujCsu5I8tpgPbwuxdMOY94fNhSXrYkY8IuX1g1zdq/Z1jluOaR/UqK4UpnbuJaH/F0VgDNiWh6cTD0DFGEk0b70i5wU4Q3L/S6XZQRvSuADoCbhwBKuFL5pW5n865oLVb5S3wuVdWaGwIDAQAB-----END PUBLIC KEY-----';
- it('return a key pair', function() {
- // Note: Key size here is set to value lower than minimum value
- // allowed by policy in order to keep test time reasonable.
- var keyBitLength = 1024;
- var f = function(box) {
- var encryptionKeyPair =
- box.asymmetric.service.getKeyPairForEncryption();
- expect(encryptionKeyPair).toBeDefined();
- };
- f.policies = {
- asymmetric: {
- keypair: {
- encryption: {
- algorithm: Config.asymmetric.keypair.encryption.algorithm.RSA,
- provider: Config.asymmetric.keypair.encryption.provider.FORGE,
- keyLength: keyBitLength,
- publicExponent:
- Config.asymmetric.keypair.encryption.publicExponent.F4
- },
- secureRandom: {
- provider: Config.asymmetric.keypair.secureRandom.provider.SCYTL
- }
- }
- }
- };
- cryptolib('asymmetric.service', f);
- });
- it('return a signature and verify it', function() {
- cryptolib('asymmetric.service', 'commons.utils', function(box) {
- var converters = new box.commons.utils.Converters();
- var dataB64;
- dataB64 = converters.base64Encode(_plaintext);
- var arrayDataBase64 = [dataB64];
- var signatureBase64 =
- box.asymmetric.service.sign(_privateKeyPem, arrayDataBase64);
- var verified = box.asymmetric.service.verifySignature(
- signatureBase64, _publicKeyPem, arrayDataBase64);
- expect(verified).toBeTruthy();
- });
- });
- it('encrypts and decrypts data', function() {
- cryptolib('asymmetric.service', 'commons.utils', function(box) {
- var converters = new box.commons.utils.Converters();
- var dataB64 = converters.base64Encode(_plaintext);
- var encryptedDataB64 =
- box.asymmetric.service.encrypt(_publicKeyPem, dataB64);
- var decryptedDataB64 =
- box.asymmetric.service.decrypt(_privateKeyPem, encryptedDataB64);
- expect(decryptedDataB64).toBe(dataB64);
- });
- });
- it('verifies a signed xml', function() {
- cryptolib('asymmetric.service', 'commons.utils', function(box) {
- var inStream =
- [
- '<?xml version="1.0" encoding="UTF-8"?>',
- '<EML xmlns="urn:oasis:names:tc:evs:schema:eml" xmlns:scytl="http://www.scytl.com/schema/eml5.0/other" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:xnl="urn:oasis:names:tc:ciq:xsdschema:xNL:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Id="410-Ballots" SchemaVersion="5.0" xsi:schemaLocation="urn:oasis:names:tc:evs:schema:eml 410-ballots-v5-0.xsd http://www.scytl.com/schema/eml5.0/other other.xsd">',
- ' <TransactionId>testTransactionId</TransactionId>',
- ' <MessageLanguage>en</MessageLanguage>',
- ' <Seal>',
- ' <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><DigestValue>XICOqyVby006j6ziAkGhRV4mjqy0xcLHlTrhj0YpBag=</DigestValue></Reference></SignedInfo><SignatureValue>dNqz4wgVx4Ofp11kxuW2YABryNZdPpxWZskI0hevRMJVNh0MzY2hJd23nKajF9m6QOk+nRJW3ez9',
- 'KO2bG6vgSvoHmyRdpsi1yuzMk6zWGY2lwwJ4JFXFq/9R/ii64Y1GCJlg2JJWx4JCDZxwV8lCCgnp',
- '3N44Izt09pyT8441dHw=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>t+qknJd/Kdo09fvQrRThqh/3EyDQj8zT1ZT7uXmivni4Vaysf6zHv+oORIvAt9ntZE2ZCif9v6CC',
- 'W+hmRFkdgRoVpmD2TErjykzowx6Ffyf5BkVnVB89+g/ZqNyyvXiBe8SmpBrRLOMifnbacyrJcsrH',
- 'fwlCnuyGKXj1LfzDcR8=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo></Signature></Seal>',
- ' <Ballots>',
- ' <EventIdentifier Id="402880002c599a48012c59b1de6c0019">',
- ' <EventAlias>ELECTION_EVENT_1</EventAlias>',
- ' </EventIdentifier>',
- ' <Ballot>',
- ' <Election>',
- ' <ElectionIdentifier Id="8080808032432a4b01324332702c0002">',
- ' <ElectionGroup Id="402880002c599a48012c59b0e4130001"/>',
- ' </ElectionIdentifier>',
- ' <Description>',
- ' <Message Format="plainText" Id="8080808032432a4b01324332702c0008" Lang="en" TranslationId="8080808032432a4b01324332702d0009" Type="title">Default Message_3_1</Message>',
- ' <Message Format="plainText" Id="8080808032432a4b01324332702c0008" Lang="es" TranslationId="8080808032432a4b01324332702d000a" Type="title">Mensaje por Defecto_3_1</Message>',
- ' <Message Format="plainText" Id="8080808032432a4b01324332702c0008" Lang="ca" TranslationId="8080808032432a4b01324332702d000b" Type="title">Missatge per Defecte_3_1</Message>',
- ' <Message Format="plainText" Id="8080808032432a4b01324332702c0008" Lang="fr" TranslationId="8080808032432a4b01324332702d000c" Type="title">Message par defaut_3_1</Message>',
- ' </Description>',
- ' <Messages>',
- ' <Message Format="plainText" Id="8080808032432a4b01324332702c0003" Lang="en" TranslationId="8080808032432a4b01324332702c0004" Type="alternateReceiptMessage">Default Message</Message>',
- ' <Message Format="plainText" Id="8080808032432a4b01324332702c0003" Lang="es" TranslationId="8080808032432a4b01324332702c0005" Type="alternateReceiptMessage">Mensaje por Defecto</Message>',
- ' <Message Format="plainText" Id="8080808032432a4b01324332702c0003" Lang="ca" TranslationId="8080808032432a4b01324332702c0006" Type="alternateReceiptMessage">Missatge per Defecte</Message>',
- ' <Message Format="plainText" Id="8080808032432a4b01324332702c0003" Lang="fr" TranslationId="8080808032432a4b01324332702c0007" Type="alternateReceiptMessage">Message par defaut</Message>',
- ' </Messages>',
- ' </Election>',
- ' <BallotIdentifier Id="GLOBAL_DISTRICT"/>',
- ' <scytl:ShowReceipt>true</scytl:ShowReceipt>',
- ' <scytl:RedirectExitUrl/>',
- ' <scytl:RedirectHelpUrl/>',
- ' </Ballot>',
- ' </Ballots>',
- '</EML>'
- ].join('\n');
- var publicKeyPem = [
- '-----BEGIN CERTIFICATE-----',
- 'MIICcTCCAVmgAwIBAgIBATANBgkqhkiG9w0BAQQFADA+MQswCQYDVQQGEwJFUzEbMBkGA1UEChMS',
- 'U2N5dGwgVU5JVCBURVNUIENBMRIwEAYDVQQLEwlVTklUIFRFU1QwHhcNMDYwMzAyMTEwOTEyWhcN',
- 'MzAwNDA2MTEwOTEyWjA+MQswCQYDVQQGEwJFUzEbMBkGA1UEChMSU2N5dGwgVU5JVCBURVNUIENB',
- 'MRIwEAYDVQQLEwlVTklUIFRFU1QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALfqpJyXfyna',
- 'NPX70K0U4aof9xMg0I/M09WU+7l5or54uFWsrH+sx7/qDkSLwLfZ7WRNmQon/b+gglvoZkRZHYEa',
- 'FaZg9kxK48pM6MMehX8n+QZFZ1QfPfoP2ajcsr14gXvEpqQa0SzjIn522nMqyXLKx38JQp7shil4',
- '9S38w3EfAgMBAAEwDQYJKoZIhvcNAQEEBQADggEBAJrtSsuqdB3RvGZMriETpO0pqQsBhZ+JRYqs',
- '5dFIiC+bdJE+dUB6v8fpv1exSQ0+i+e1oTs2I9Wd4eIQ4rlZCG9K6EYBKP9Z59OBDTf6luaisoul',
- '6gnKW7+kUfQQkBfJJw/4RA7FbaAmYNGEEfXTwDMU+ZoqIO/PV+JsfOtFUdPcwv1hPQHTE+KR1DtR',
- 'AC+A4Ak+fOoaRnyTprvbT4inaPdn6D9fBrIpO6hQSAtM5K9+/VaskMSFqw03DkADRyxHacdz9JLp',
- '5ChDbRrXCDdT/a832acPDViS3nG/GhuSTK8mlrXeHjpG6vaSbKiXNXwrwz80k/XoNh3k5jlfrzUM',
- 'CQ4=', '-----END CERTIFICATE-----'
- ].join('\n');
- var signatureParentNode = 'EML/Seal/Signature';
- // get the public key
- var abCert = box.forge.pki.certificateFromPem(publicKeyPem, true);
- var publicKey = abCert.publicKey;
- // test it
- var verified = box.asymmetric.service.verifyXmlSignature(
- publicKey, inStream, signatureParentNode);
- expect(verified).toBeTruthy();
- });
- });
- it('verifies a second signed xml',
- function() {
- cryptolib(
- 'asymmetric.service', 'commons.utils', function(box) {
- var inStream = [
- '<?xml version="1.0" encoding="UTF-8"?>',
- '<EML xmlns="urn:oasis:names:tc:evs:schema:eml" xmlns:al="urn:oasis:names:tc:ciq:xal:4" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:nl="urn:oasis:names:tc:ciq:xnl:4" xmlns:ts="urn:oasis:names:tc:evs:schema:eml:ts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Id="330" SchemaVersion="7.0" xsi:schemaLocation="urn:oasis:names:tc:evs:schema:eml ../../330-electionlist-v7-0.xsd">',
- ' <EMLHeader>',
- ' <TransactionId>330</TransactionId>',
- ' <SequenceNumber>1</SequenceNumber>',
- ' <NumberInSequence>1</NumberInSequence>',
- ' <SequencedElementName>Set20131125</SequencedElementName>',
- ' <OfficialStatusDetail>',
- ' <OfficialStatus/>',
- ' <StatusDate>2013-11-25</StatusDate>',
- ' </OfficialStatusDetail>',
- ' <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><DigestValue>BbEhPY/Q2JegRUtLYUR/9I0ColZlnKVG4kZ9U2fjh6k=</DigestValue></Reference></SignedInfo><SignatureValue>vXdMpLJB1ECStXim5aO0bpOq/Em6OA/zH/uAPI4nWTUjoRPeMHO/YkeJl4jfL/ImQtisTVG6mBpa',
- 'LejeM6PKBv9G5zTnymZn+1mn2iRpKkW5MB+cbifPfh6ut7RHWfA4N3ZAxYz+Zh5WEMDZLPapuLTM',
- 'qbczC9THziQRgdvEcn0=</SignatureValue></Signature></EMLHeader>',
- ' <ElectionList>',
- ' <Qualifier>',
- ' <VoterGroup>MILITARY_NOTOVERSEAS</VoterGroup>',
- ' </Qualifier>',
- ' <PollingDistrict>',
- ' <Name>Sebastian</Name>',
- ' <Association Id="AR-66"/>',
- ' </PollingDistrict>',
- ' <EventIdentifier IdNumber="GE2013"/>',
- ' <EventDate>',
- ' <Start>2013-12-24</Start>',
- ' <End>2013-12-24</End>',
- ' </EventDate>',
- ' <VoterDetails>',
- ' <RequestedAction>add</RequestedAction>',
- ' <VoterRegistration>',
- ' <Voter>',
- ' <VoterIdentification Id="3545231">',
- ' <VoterName>',
- ' <nl:PersonNameDetail>',
- ' <nl:NamePrefixText/>',
- ' <nl:GivenName>Steven</nl:GivenName>',
- ' <nl:MiddleName/>',
- ' <nl:FamilyName>Perez</nl:FamilyName>',
- ' <nl:NameSuffixText/>',
- ' </nl:PersonNameDetail>',
- ' </VoterName>',
- ' <ElectoralAddress>',
- ' <al:FreeTextAddress>',
- ' <al:AddressLine seqn="1" type="RegisteredAddress">1434 N 34th St </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="RegisteredAddress">Fort Smith, AR</al:AddressLine>',
- ' <al:AddressLine type="RegisteredAddressPostalCode">72904</al:AddressLine>',
- ' <al:AddressLine seqn="1" type="MailToAddress">123 man line 1 address </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="MailoAddress">somewheretown, OR </al:AddressLine>',
- ' <al:AddressLine type="MailToAddressPostalCode">11236-5456</al:AddressLine>',
- ' <al:AddressLine type="email">ballotsafe-test+ARvoter11@scytl.com</al:AddressLine>',
- ' </al:FreeTextAddress>',
- ' </ElectoralAddress>',
- ' <VToken VTokenId="GE20133545231">',
- ' <Component/>',
- ' <BallotIdentifier IdNumber="1-A.01"/>',
- ' </VToken>',
- ' <VoterId type="driverslicense"/>',
- ' </VoterIdentification>',
- ' <VoterInformation>',
- ' <DateOfBirth>1983-03-16</DateOfBirth>',
- ' <PreferredLanguage>en-US</PreferredLanguage>',
- ' <Affiliation>Republican</Affiliation>',
- ' </VoterInformation>',
- ' <BallotFormIdentifier Permitted="yes" Received="no" Voted="no">1-A.01</BallotFormIdentifier>',
- ' <Messages>',
- ' <Message/>',
- ' </Messages>',
- ' </Voter>',
- ' </VoterRegistration>',
- ' <Election>',
- ' <PollingDistrict>',
- ' <Name>Sebastian</Name>',
- ' <Association Id="AR-66"/>',
- ' </PollingDistrict>',
- ' <PollingPlace Channel="polling" IdNumber="1-A.01">',
- ' <OtherLocation>1-A.1</OtherLocation>',
- ' </PollingPlace>',
- ' </Election>',
- ' </VoterDetails>',
- ' <VoterDetails>',
- ' <RequestedAction>add</RequestedAction>',
- ' <VoterRegistration>',
- ' <Voter>',
- ' <VoterIdentification Id="502445">',
- ' <VoterName>',
- ' <nl:PersonNameDetail>',
- ' <nl:NamePrefixText/>',
- ' <nl:GivenName>Mingkhone</nl:GivenName>',
- ' <nl:MiddleName/>',
- ' <nl:FamilyName>Ratsamy</nl:FamilyName>',
- ' <nl:NameSuffixText/>',
- ' </nl:PersonNameDetail>',
- ' </VoterName>',
- ' <ElectoralAddress>',
- ' <al:FreeTextAddress>',
- ' <al:AddressLine seqn="1" type="RegisteredAddress">1443 N 44th St </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="RegisteredAddress">Fort Smith, AR</al:AddressLine>',
- ' <al:AddressLine type="RegisteredAddressPostalCode">72904</al:AddressLine>',
- ' <al:AddressLine seqn="1" type="MailToAddress">Line 1 address length in all address fields for </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="MailoAddress">somewheretown, CA </al:AddressLine>',
- ' <al:AddressLine type="MailToAddressPostalCode">11123-4567</al:AddressLine>',
- ' <al:AddressLine type="email">ballotsafe-test+ARvoter12@scytl.com</al:AddressLine>',
- ' </al:FreeTextAddress>',
- ' </ElectoralAddress>',
- ' <VToken VTokenId="GE2013502445">',
- ' <Component/>',
- ' <BallotIdentifier IdNumber="1-A.01"/>',
- ' </VToken>',
- ' <VoterId type="driverslicense"/>',
- ' </VoterIdentification>',
- ' <VoterInformation>',
- ' <DateOfBirth>1987-03-23</DateOfBirth>',
- ' <PreferredLanguage>en-US</PreferredLanguage>',
- ' <Affiliation>Democratic</Affiliation>',
- ' </VoterInformation>',
- ' <BallotFormIdentifier Permitted="yes" Received="no" Voted="no">1-A.01</BallotFormIdentifier>',
- ' <Messages>',
- ' <Message/>',
- ' </Messages>',
- ' </Voter>',
- ' </VoterRegistration>',
- ' <Election>',
- ' <PollingDistrict>',
- ' <Name>Sebastian</Name>',
- ' <Association Id="AR-66"/>',
- ' </PollingDistrict>',
- ' <PollingPlace Channel="polling" IdNumber="1-A.01">',
- ' <OtherLocation>1-A.1</OtherLocation>',
- ' </PollingPlace>',
- ' </Election>',
- ' </VoterDetails>',
- ' <VoterDetails>',
- ' <RequestedAction>add</RequestedAction>',
- ' <VoterRegistration>',
- ' <Voter>',
- ' <VoterIdentification Id="501990">',
- ' <VoterName>',
- ' <nl:PersonNameDetail>',
- ' <nl:NamePrefixText/>',
- ' <nl:GivenName>James</nl:GivenName>',
- ' <nl:MiddleName>Maxwell</nl:MiddleName>',
- ' <nl:FamilyName>Smith</nl:FamilyName>',
- ' <nl:NameSuffixText>Sr </nl:NameSuffixText>',
- ' </nl:PersonNameDetail>',
- ' </VoterName>',
- ' <ElectoralAddress>',
- ' <al:FreeTextAddress>',
- ' <al:AddressLine seqn="1" type="RegisteredAddress">1534 N 49th St </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="RegisteredAddress">Fort Smith, AR</al:AddressLine>',
- ' <al:AddressLine type="RegisteredAddressPostalCode">72904</al:AddressLine>',
- ' <al:AddressLine seqn="1" type="MailToAddress">',
- 'test address length in all address fields for scyt </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="MailoAddress">somewheretownusa, mt </al:AddressLine>',
- ' <al:AddressLine type="MailToAddressPostalCode">21453-3335</al:AddressLine>',
- ' <al:AddressLine type="email">ballotsafe-test+ARvoter13@scytl.com</al:AddressLine>',
- ' </al:FreeTextAddress>',
- ' </ElectoralAddress>',
- ' <VToken VTokenId="GE2013501990">',
- ' <Component/>',
- ' <BallotIdentifier IdNumber="1-A.01"/>',
- ' </VToken>',
- ' <VoterId type="driverslicense"/>',
- ' </VoterIdentification>',
- ' <VoterInformation>',
- ' <DateOfBirth>1956-02-29</DateOfBirth>',
- ' <PreferredLanguage>en-US</PreferredLanguage>',
- ' <Affiliation>Optional</Affiliation>',
- ' </VoterInformation>',
- ' <BallotFormIdentifier Permitted="yes" Received="no" Voted="no">1-A.01</BallotFormIdentifier>',
- ' <Messages>',
- ' <Message/>',
- ' </Messages>',
- ' </Voter>',
- ' </VoterRegistration>',
- ' <Election>',
- ' <PollingDistrict>',
- ' <Name>Sebastian</Name>',
- ' <Association Id="AR-66"/>',
- ' </PollingDistrict>',
- ' <PollingPlace Channel="polling" IdNumber="1-A.01">',
- ' <OtherLocation>1-A.1</OtherLocation>',
- ' </PollingPlace>',
- ' </Election>',
- ' </VoterDetails>',
- ' <VoterDetails>',
- ' <RequestedAction>add</RequestedAction>',
- ' <VoterRegistration>',
- ' <Voter>',
- ' <VoterIdentification Id="3558060">',
- ' <VoterName>',
- ' <nl:PersonNameDetail>',
- ' <nl:NamePrefixText/>',
- ' <nl:GivenName>Jordan</nl:GivenName>',
- ' <nl:MiddleName>Elizabeth</nl:MiddleName>',
- ' <nl:FamilyName>Stephenson</nl:FamilyName>',
- ' <nl:NameSuffixText/>',
- ' </nl:PersonNameDetail>',
- ' </VoterName>',
- ' <ElectoralAddress>',
- ' <al:FreeTextAddress>',
- ' <al:AddressLine seqn="1" type="RegisteredAddress">700 N Albert Pike, Apt 1204 </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="RegisteredAddress">Fort Smith, AR</al:AddressLine>',
- ' <al:AddressLine type="RegisteredAddressPostalCode">72903</al:AddressLine>',
- ' <al:AddressLine seqn="1" type="MailToAddress">test address length in all address fields for scyt Line 2 address length in all address fields for Line 3 address length in all address fields for Line 4 address length in all address fields for </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="MailoAddress">somewheretown, cn </al:AddressLine>',
- ' <al:AddressLine type="MailToAddressPostalCode">11123-4555</al:AddressLine>',
- ' <al:AddressLine type="email">ballotsafe-test+ARvoter14@scytl.com</al:AddressLine>',
- ' </al:FreeTextAddress>',
- ' </ElectoralAddress>',
- ' <VToken VTokenId="GE20133558060">',
- ' <Component/>',
- ' <BallotIdentifier IdNumber="1-A.01"/>',
- ' </VToken>',
- ' <VoterId type="driverslicense"/>',
- ' </VoterIdentification>',
- ' <VoterInformation>',
- ' <DateOfBirth>1992-08-31</DateOfBirth>',
- ' <PreferredLanguage>en-US</PreferredLanguage>',
- ' <Affiliation>Optional</Affiliation>',
- ' </VoterInformation>',
- ' <BallotFormIdentifier Permitted="yes" Received="no" Voted="no">1-A.01</BallotFormIdentifier>',
- ' <Messages>',
- ' <Message/>',
- ' </Messages>',
- ' </Voter>',
- ' </VoterRegistration>',
- ' <Election>',
- ' <PollingDistrict>',
- ' <Name>Sebastian</Name>',
- ' <Association Id="AR-66"/>',
- ' </PollingDistrict>',
- ' <PollingPlace Channel="polling" IdNumber="1-A.01">',
- ' <OtherLocation>1-A.1</OtherLocation>',
- ' </PollingPlace>',
- ' </Election>',
- ' </VoterDetails>',
- ' <VoterDetails>',
- ' <RequestedAction>add</RequestedAction>',
- ' <VoterRegistration>',
- ' <Voter>',
- ' <VoterIdentification Id="893572">',
- ' <VoterName>',
- ' <nl:PersonNameDetail>',
- ' <nl:NamePrefixText/>',
- ' <nl:GivenName>Donna</nl:GivenName>',
- ' <nl:MiddleName>S</nl:MiddleName>',
- ' <nl:FamilyName>Van Evera</nl:FamilyName>',
- ' <nl:NameSuffixText/>',
- ' </nl:PersonNameDetail>',
- ' </VoterName>',
- ' <ElectoralAddress>',
- ' <al:FreeTextAddress>',
- ' <al:AddressLine seqn="1" type="RegisteredAddress">4420 Kinkead </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="RegisteredAddress">Fort Smith, AR</al:AddressLine>',
- ' <al:AddressLine type="RegisteredAddressPostalCode">72903</al:AddressLine>',
- ' <al:AddressLine seqn="1" type="MailToAddress">test address length in all address fields for scyt Line 3 address length in all address fields for sc </al:AddressLine>',
- ' <al:AddressLine seqn="2" type="MailoAddress">anywheretown, vt </al:AddressLine>',
- ' <al:AddressLine type="MailToAddressPostalCode">12546-3333</al:AddressLine>',
- ' <al:AddressLine type="email">ballotsafe-test+ARvoter15@scytl.com</al:AddressLine>',
- ' </al:FreeTextAddress>',
- ' </ElectoralAddress>',
- ' <VToken VTokenId="GE2013893572">',
- ' <Component/>',
- ' <BallotIdentifier IdNumber="1-A.01"/>',
- ' </VToken>',
- ' <VoterId type="driverslicense"/>',
- ' </VoterIdentification>',
- ' <VoterInformation>',
- ' <DateOfBirth>1952-12-21</DateOfBirth>',
- ' <PreferredLanguage>en-US</PreferredLanguage>',
- ' <Affiliation>Optional</Affiliation>',
- ' </VoterInformation>',
- ' <BallotFormIdentifier Permitted="yes" Received="no" Voted="no">1-A.01</BallotFormIdentifier>',
- ' <Messages>',
- ' <Message/>',
- ' </Messages>',
- ' </Voter>',
- ' </VoterRegistration>',
- ' <Election>',
- ' <PollingDistrict>',
- ' <Name>Sebastian</Name>',
- ' <Association Id="AR-66"/>',
- ' </PollingDistrict>',
- ' <PollingPlace Channel="polling" IdNumber="1-A.01">',
- ' <OtherLocation>1-A.1</OtherLocation>',
- ' </PollingPlace>',
- ' </Election>',
- ' </VoterDetails>',
- ' </ElectionList>',
- '</EML>'
- ].join('\n');
- var publicKeyPem = [
- '-----BEGIN CERTIFICATE-----',
- 'MIICfjCCAeegAwIBAgIJAJQ9YClOoquEMA0GCSqGSIb3DQEBBQUAMFgxCzAJBgNV',
- 'BAYTAlVTMQwwCgYDVQQIDANXQVMxDDAKBgNVBAcMA1dBUzEMMAoGA1UECgwDU09F',
- 'MQ8wDQYDVQQLDAZTT0VfUUExDjAMBgNVBAMMBVRlc3QyMB4XDTE0MTExMjE0MDA0',
- 'MVoXDTE1MTExMjE0MDA0MVowWDELMAkGA1UEBhMCVVMxDDAKBgNVBAgMA1dBUzEM',
- 'MAoGA1UEBwwDV0FTMQwwCgYDVQQKDANTT0UxDzANBgNVBAsMBlNPRV9RQTEOMAwG',
- 'A1UEAwwFVGVzdDIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL/9d+ZKlFSn',
- 'j7hJTGTOStQv+4TCc4cdKjGeCTOqj8J6ShxBfB03x/PVZgv4bWdZjjz7TT+adLq9',
- 'FhTn064mZJW6PL+6Dv1EENMDp/RavvFbQG0Egkqg6Gxo7ttp2dGzt2AXN9veH2UB',
- 'alkIFG85dTQ6nb+W3nyJCs1k80eSGFfPAgMBAAGjUDBOMB0GA1UdDgQWBBQBXb/9',
- 'TEOHKOqgrIG3wXsspccXMjAfBgNVHSMEGDAWgBQBXb/9TEOHKOqgrIG3wXsspccX',
- 'MjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAJiUTSthh3SAJIDxhCoe',
- '20xFwdjXEEU8MMODEh3ibHzFcf9JXqkTAhZ8ExtFsMzpDEi7YBNB+FkBpFEtkzRA',
- 'BLK7JmLkje7lg3aXz6PRRd/LegrRmT1klFUHmqKEBJt5185UE2B8mDXWJEdptLsR',
- '8AEw5IwDqHQWPA6gk8XyQ5s6', '-----END CERTIFICATE-----'
- ].join('\n');
- var signatureParentNode = 'EML/EMLHeader/Signature';
- // get the public key
- var abCert =
- box.forge.pki.certificateFromPem(publicKeyPem, true);
- var publicKey = abCert.publicKey;
- // test it
- var verified = box.asymmetric.service.verifyXmlSignature(
- publicKey, inStream, signatureParentNode);
- expect(verified).toBeTruthy();
- });
- });
- it('verifies a third signed xml', function() {
- /*jshint smarttabs:true */
- cryptolib('asymmetric.service', 'commons.utils', function(box) {
- var inStream = [
- '<?xml version="1.0" encoding="UTF-8"?>',
- '<xml xmlns="urn:oasis:names:tc:evs:schema:eml" xmlns:nswec="urn:nswec:events:emlExtension" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:xnl="urn:oasis:names:tc:ciq:xsdschema:xNL:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:evs:schema:eml http://docs.oasis-open.org/election/eml/v5.0/os/EML-Schemas-v5.0/110-electionevent-v5-0.xsd urn:nswec:events:emlExtension http://www.elections.nsw.gov.au/standards/XML/emlcore-v5-0-NSWEC.xsd">',
- ' <ElectionEvent graceperiod="1800"> <!-- grace period is the time in seconds allowed after loginEnd to cast a vote, this period applies to all Voting Modes -->',
- ' <EventIdentifier Id="SG1409-110">',
- ' <EventQualifier Id="SG1409">NSW State General Election 2015</EventQualifier>',
- ' </EventIdentifier>',
- ' <Election>',
- ' <iVoteModes>',
- ' <iVoteMode name="Test">',
- ' <Venues>',
- ' <Venue IssuingVenue="NSW" ballotboxid="SG1409-BB-000" id="00" venueid="SG1409-VN-000"/>',
- ' </Venues>',
- ' <Periods type="votingmode">',
- ' <Period loginEnd="2015-03-28T18:00:00+10:00" loginStart="2014-03-16T08:00:00+10:00" name="test"/>',
- ' <Closing manual="yes"/>',
- ' </Periods>',
- ' <VotingClients>',
- ' <VotingClient type="web"/>',
- ' <VotingClient type="phone"/>',
- ' </VotingClients>',
- ' </iVoteMode>',
- ' <iVoteMode name="Attendance">',
- ' <Periods type="venues"> <!-- As well as defining iVote login times, these datetimes would be used by CVS to distinguish between prepoll and Election Day votes -->',
- ' <Period loginEnd="2015-03-27T20:00:00+10:00" loginStart="2014-03-16T08:00:00+10:00" name="prepoll"/>',
- ' <Period loginEnd="2015-03-28T20:00:00+10:00" loginStart="2014-03-28T08:00:00+10:00" name="electionday"/>',
- ' <Closing manual="yes"/>',
- ' </Periods>',
- ' <Venues>',
- ' <Venue IssuingDistrict="Sydney" IssuingVenue="SydneyTownHall" ballotboxid="SG1409-BB-001" id="01" venueid="SG1409-VN-001"/>',
- ' <Venue IssuingDistrict="Bega" IssuingVenue="CandeloTownHall" ballotboxid="SG1409-BB-002" id="02" venueid="SG1409-VN-002"/>',
- ' </Venues>',
- ' <VotingClients>',
- ' <VotingClient type="web"/>',
- ' </VotingClients>',
- ' </iVoteMode>',
- ' <iVoteMode name="Remote Venue">',
- ' <Periods type="votingmode">',
- ' <Period loginEnd="2015-03-28T18:00:00+10:00" loginStart="2014-03-16T08:00:00+10:00" name="remotevenue"/>',
- ' <Closing manual="yes"/>',
- ' </Periods>',
- ' <Venues>',
- ' <Venue IssuingVenue="NSW" ballotboxid="SG1409-BB-003" id="03" venueid="SG1409-VN-003"/>',
- ' </Venues>',
- ' <VotingClients>',
- ' <VotingClient type="web"/>',
- ' </VotingClients>',
- ' </iVoteMode>',
- ' <iVoteMode name="Remote">',
- ' <Venues>',
- ' <Venue IssuingVenue="NSW" ballotboxid="SG1409-BB-003" id="04" venueid="SG1409-VN-003"/>',
- ' </Venues>',
- ' <Periods type="votingmode">',
- ' <Period loginEnd="2015-03-28T18:00:00+10:00" loginStart="2014-03-16T08:00:00+10:00" name="remote"/>',
- ' <Closing manual="no"/>',
- ' </Periods>',
- ' <VotingClients>',
- ' <VotingClient type="web"/>',
- ' <VotingClient type="phone"/>',
- ' </VotingClients>',
- ' </iVoteMode>',
- ' ',
- ' </iVoteModes>',
- ' <contest>',
- ' <Area Id="100" Type="LA District">Albury</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="200" Type="LA District">Auburn</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="300" Type="LA District">Ballina</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="400" Type="LA District">Balmain</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="500" Type="LA District">Bankstown</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="600" Type="LA District">Barwon</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="700" Type="LA District">Bathurst</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="800" Type="LA District">Baulkham Hills</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="900" Type="LA District">Bega</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1000" Type="LA District">Blacktown</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1100" Type="LA District">Blue Mountains</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1200" Type="LA District">Burrinjuck</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1300" Type="LA District">Cabramatta</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1400" Type="LA District">Camden</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1500" Type="LA District">Campbelltown</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1600" Type="LA District">Canterbury</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1700" Type="LA District">Castle Hill</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1800" Type="LA District">Cessnock</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="1900" Type="LA District">Charlestown</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2000" Type="LA District">Clarence</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2100" Type="LA District">Coffs Harbour</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2200" Type="LA District">Coogee</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2300" Type="LA District">Cronulla</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2400" Type="LA District">Davidson</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2500" Type="LA District">Drummoyne</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2600" Type="LA District">Dubbo</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2700" Type="LA District">East Hills</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2800" Type="LA District">Epping</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="2900" Type="LA District">Fairfield</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3000" Type="LA District">Gosford</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3100" Type="LA District">Goulburn</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3200" Type="LA District">Granville</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3300" Type="LA District">Hawkesbury</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3400" Type="LA District">Heathcote</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3500" Type="LA District">Heffron</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3600" Type="LA District">Hornsby</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3700" Type="LA District">Keira</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3800" Type="LA District">Kiama</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="3900" Type="LA District">Kogarah</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4000" Type="LA District">Ku-ring-gai</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4100" Type="LA District">Lake Macquarie</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4200" Type="LA District">Lakemba</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4300" Type="LA District">Lane Cove</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4400" Type="LA District">Lismore</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4500" Type="LA District">Liverpool</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4600" Type="LA District">Londonderry</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4700" Type="LA District">Macquarie Fields</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4800" Type="LA District">Maitland</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="4900" Type="LA District">Manly</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5000" Type="LA District">Maroubra</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5100" Type="LA District">Marrickville</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5200" Type="LA District">Menai</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5300" Type="LA District">Miranda</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5400" Type="LA District">Monaro</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5500" Type="LA District">Mount Druitt</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5600" Type="LA District">Mulgoa</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5700" Type="LA District">Murray-Darling</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5800" Type="LA District">Murrumbidgee</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="5900" Type="LA District">Myall Lakes</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6000" Type="LA District">Newcastle</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6100" Type="LA District">North Shore</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6200" Type="LA District">Northern Tablelands</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6300" Type="LA District">Oatley</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6400" Type="LA District">Orange</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6500" Type="LA District">Oxley</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6600" Type="LA District">Parramatta</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6700" Type="LA District">Penrith</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6800" Type="LA District">Pittwater</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="6900" Type="LA District">Port Macquarie</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7000" Type="LA District">Port Stephens</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7100" Type="LA District">Riverstone</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7200" Type="LA District">Rockdale</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7300" Type="LA District">Ryde</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7400" Type="LA District">Shellharbour</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7500" Type="LA District">Smithfield</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7600" Type="LA District">South Coast</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7700" Type="LA District">Strathfield</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7800" Type="LA District">Swansea</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="7900" Type="LA District">Sydney</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8000" Type="LA District">Tamworth</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8100" Type="LA District">Terrigal</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8200" Type="LA District">The Entrance</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8300" Type="LA District">Toongabbie</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8400" Type="LA District">Tweed</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8500" Type="LA District">Upper Hunter</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8600" Type="LA District">Vaucluse</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8700" Type="LA District">Wagga Wagga</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8800" Type="LA District">Wakehurst</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="8900" Type="LA District">Wallsend</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="9000" Type="LA District">Willoughby</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="9100" Type="LA District">Wollondilly</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="9200" Type="LA District">Wollongong</Area>',
- ' </contest>',
- ' <contest>',
- ' <Area Id="9300" Type="LA District">Wyong</Area>',
- ' </contest>',
- ' </Election>',
- ' <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><DigestValue>KRK0/Hnx6VMJdEycg9JSKM5RbCL/iXbvrXKdfjoAXpU=</DigestValue></Reference></SignedInfo><SignatureValue>ah0dEIsFANQFtXXNghqQ39ll6l6Nh4tE16/Tm0BnEaWd/GhdtzrGBszed+ugnpcqFYje4rm2fW8a',
- 'BihAsFz7A748B27fu8yBQbqG6qiSGkiH+51aRJtLl7MxYEB1w614Lq4t1zzVjWLu/9BaS2Op3dSg',
- 'wcw1xDVBaJg5k9gGiQ0qDbMcQfMFmycwShWpu45O62ezUsEn8Jw54qap5Tfg+7vklSSqh7OURnrb',
- '84+3GOjwy4ML3kLRbNI8iksjoQUSa8j5zYOsTdWIewnjgb5jn/YgIUZPcZFnca5SE+i1IkmzZxD5',
- 'ztCMeqxKpFcQpIVHGL81fpwxL5cterxDq8uzwA==</SignatureValue></Signature></ElectionEvent>',
- '</xml>'
- ].join('\n');
- var publicKeyPem = [
- '-----BEGIN PUBLIC KEY-----',
- 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2yUCdVp5rCWUae2wpR3f',
- 'r6TNFj/sz7to9ATk++gQ69iEHLTqHz38JLT4So74peGXX1VzVNGLOi1o5kTGmoDN',
- 'erj0bO8h2FTyXTn73R0C8oyNGfI+WcloO8uHLn5GktMxweYtVfAgvkm0k9P44K2K',
- 'WMQq1jkdvNu2ItZN4DXdADfeEstB3d/XtRZ6Q2xaQCgGytSGeejnToNMEzid7vr2',
- 'zctWfcLYJ9ljon33pzJbkfu14I4/amLd8bVNxAZ55JyDRUghjll0xz41AyGpXApu',
- 'MeChOJkKYl4UfYH330syGHcqETEGh9akJJg+kUXeDVwn4qS08EnG4qOhEDs1Od8K',
- 'qQIDAQAB', '-----END PUBLIC KEY-----'
- ].join('\n');
- var signatureParentNode = 'xml/ElectionEvent/Signature';
- // get the public key
- var publicKey = forge.pki.publicKeyFromPem(publicKeyPem);
- // test it
- var verified = box.asymmetric.service.verifyXmlSignature(
- publicKey, inStream, signatureParentNode);
- expect(verified).toBeTruthy();
- });
- });
- it('verifies a xml using public key', function() {
- cryptolib('asymmetric.service', 'commons.utils', function(box) {
- var inStream = [
- '<?xml version="1.0" encoding="UTF-8"?>',
- '<EML xmlns="urn:oasis:names:tc:evs:schema:eml" xmlns:nswec="urn:nswec:events:emlExtension" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:xnl="urn:oasis:names:tc:ciq:xsdschema:xNL:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Id="410-ballots-v5-0" SchemaVersion="5.0" xsi:schemaLocation="urn:oasis:names:tc:evs:schema:eml http://docs.oasis-open.org/election/eml/v5.0/os/EML-Schemas-v5.0/410-ballots-v5-0.xsd urn:nswec:events:emlExtension http://www.elections.nsw.gov.au/standards/XML/emlcore-v5-0-NSWEC.xsd">',
- ' <TransactionId>5.04100001228337</TransactionId>',
- ' <SequenceNumber>78</SequenceNumber>',
- ' <NumberInSequence>94</NumberInSequence>',
- ' <SequencedElementName>Summer-Hill</SequencedElementName>',
- ' <ManagingAuthority>',
- ' <AuthorityIdentifier Id="EMS.ID.0007649">Returning Office for Summer Hill</AuthorityIdentifier>',
- ' <AuthorityAddress>',
- ' <xal:AddressLines>',
- ' <xal:AddressLine Type="AddressName">Summer Hill Returning Office</xal:AddressLine>',
- ' <xal:AddressLine Type="AddressLine1">Ground Floor Suite 1</xal:AddressLine>',
- ' <xal:AddressLine Type="AddressLine2">109 Jessie Street</xal:AddressLine>',
- ' <xal:AddressLine Type="LocalityName">Summer Hill</xal:AddressLine>',
- ' <xal:AddressLine Type="State">NSW</xal:AddressLine>',
- ' <xal:AddressLine Type="Postcode">2378</xal:AddressLine>',
- ' <xal:AddressLine Type="Country">Australia</xal:AddressLine>',
- ' </xal:AddressLines>',
- ' </AuthorityAddress>',
- ' <ResponsibleOfficer Id="00000000000000281210">',
- ' <Responsibility>Returning Officer for Summer Hill</Responsibility>',
- ' <Name>',
- ' <xnl:PersonName>',
- ' <xnl:FirstName>Peter</xnl:FirstName>',
- ' <xnl:LastName>Dooley</xnl:LastName>',
- ' </xnl:PersonName>',
- ' </Name>',
- ' <Contact>',
- ' <MailingAddress>',
- ' <xal:AddressLines>',
- ' <xal:AddressLine Type="AddressName">Summer Hill Returning Officer Office</xal:AddressLine>',
- ' <xal:AddressLine Type="AddressLine1">PO Box 629</xal:AddressLine>',
- ' <xal:AddressLine Type="LocalityName">Summer Hill</xal:AddressLine>',
- ' <xal:AddressLine Type="State">NSW</xal:AddressLine>',
- ' <xal:AddressLine Type="Postcode">2378</xal:AddressLine>',
- ' <xal:AddressLine Type="Country">Australia</xal:AddressLine>',
- ' </xal:AddressLines>',
- ' </MailingAddress>',
- ' <Email>RO.Summer_Hill@elections.nsw.gov.au</Email>',
- ' <Telephone Preferred="no">',
- ' <Number>0267727755</Number>',
- ' </Telephone>',
- ' <Telephone Preferred="yes">',
- ' <Number>1300135736</Number>',
- ' </Telephone>',
- ' </Contact>',
- ' </ResponsibleOfficer>',
- ' </ManagingAuthority>',
- ' <IssueDate>2014-11-17</IssueDate>',
- ' <Ballots>',
- ' <EventIdentifier Id="SG1409-078">',
- ' <EventName>Summer Hill</EventName>',
- ' <EventQualifier Id="SG1409">NSW State General Election 2014</EventQualifier>',
- ' </EventIdentifier>',
- ' <Ballot>',
- ' <Election>',
- ' <ElectionIdentifier Id="SG1409-078-01">',
- ' <ElectionName>Legislative Assembly Election</ElectionName>',
- ' <ElectionCategory>Parliamentary</ElectionCategory>',
- ' </ElectionIdentifier>',
- ' <Description>',
- ' <Message>Ballot Paper</Message>',
- ' </Description>',
- ' <Contest>',
- ' <ContestIdentifier Id="SG1409-078-01-00">',
- ' <ContestName>Summer Hill</ContestName>',
- ' </ContestIdentifier>',
- ' <HowToVote>',
- ' <Message Type="Preamble">DIRECTIONS FOR VOTING PLEASE READ CAREFULLY</Message>',
- ' <Message Type="SoleOption">Write the number 1 in the square next to the candidate of your choice. You can show more choices, if you want to, by writing numbers in the other squares, starting with the number 2.</Message>',
- ' <Message Type="SoleOption-AfterVoting">Fold this ballot paper so your vote cannot be seen and place it in the ballot box (or in the envelope provided).</Message>',
- ' </HowToVote>',
- ' <VotingMethod>OPV</VotingMethod>',
- ' <MaxVotes>7',
- '</MaxVotes>',
- ' <MinVotes>1</MinVotes>',
- ' <BallotChoices>',
- '<Candidate><CandidateIdentifier Id="1"><CandidateName>REN George</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__REN_George"><xnl:PersonName><xnl:FirstName NameType="Given Name">George</xnl:FirstName><xnl:LastName NameType="Surname">REN</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>INDEPENDENT</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="2"><CandidateName>TOMLINSON Richard</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__TOMLINSON_Richard"><xnl:PersonName><xnl:FirstName NameType="Given Name">Richard</xnl:FirstName><xnl:LastName NameType="Surname">TOMLINSON</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>DEMOCRATIC PARTY</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="3"><CandidateName>WILLIAMS Mark</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__WILLIAMS_Mark"><xnl:PersonName><xnl:FirstName NameType="Given Name">Mark</xnl:FirstName><xnl:LastName NameType="Surname">WILLIAMS</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>THE KHAKI PARTY</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="4"><CandidateName>ADCOCK Ben</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__ADCOCK_Ben"><xnl:PersonName><xnl:FirstName NameType="Given Name">Ben</xnl:FirstName><xnl:LastName NameType="Surname">ADCOCK</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>CONSERVATIVES</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="5"><CandidateName>YONG Mike</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__YONG_Mike"><xnl:PersonName><xnl:FirstName NameType="Given Name">Mike</xnl:FirstName><xnl:LastName NameType="Surname">YONG</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>AUSTRALIANS FOR ADVANCEMENT</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="6"><CandidateName>WITHERS John</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__WITHERS_John"><xnl:PersonName><xnl:FirstName NameType="Given Name">John</xnl:FirstName><xnl:LastName NameType="Surname">WITHERS</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>THE RELIGIOUS PARTY</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="7"><CandidateName>CALLAGHAN Paul</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__CALLAGHAN_Paul"><xnl:PersonName><xnl:FirstName NameType="Given Name">Paul</xnl:FirstName><xnl:LastName NameType="Surname">CALLAGHAN</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>WORKING PARTY</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- ' </BallotChoices>',
- ' <nswec:ContestDescription>Election of Member of Parliamant</nswec:ContestDescription>',
- ' <nswec:NumberOfPositionsContested>1</nswec:NumberOfPositionsContested>',
- ' <nswec:PrintStatus ReprintRequired="yes">',
- ' <nswec:DrawComplete>2014-11-17T16:28:01</nswec:DrawComplete>',
- ' <nswec:Previous410/>',
- ' </nswec:PrintStatus>',
- ' </Contest>',
- ' </Election>',
- ' </Ballot>',
- ' </Ballots>',
- '<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><DigestValue>mhCdaEEiuFgKJd0sBooryGBx2b9xwsF1rlX3MSDu83c=</DigestValue></Reference></SignedInfo><SignatureValue>Gu87GxyWKAu9D3fhQkjy3EcgaycGylVEmTOqW6HRXvTy+XbduWaazTfnnTjR/C7wig8+kbckXEkz',
- 'B81FBCmUJibugK6eRWkcrJPmrds5LwCQXL+4zmwmISA1pKyuGhLoGlcdupKCdT98pLmD7cauje8P',
- 'bOstRTTz5mgBqbQN9O91RMzjdov6mq53l3m4BVG4lFmxoG5L/PQ989G7vMM/K3yPQ1fCVWqguzBN',
- 'Dve+OtbiIOSF2kGmXtQ+qAUCdXNmYt+JamoU6BIsHgIiyRk9C0NKs5S2lvewJonJtf+9lLkU2OLU',
- 'FN5hFpgtWNCglHJsg0rtIFJN4fLJwK6RNpi29A==</SignatureValue></Signature></EML>'
- ].join('\n');
- var publicKeyPem = [
- '-----BEGIN PUBLIC KEY-----',
- 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAj8ZhcZnHuNfFc+C7KpSR',
- 'oaDmUf1XbT8haRQADcQF/04r5hbAsF6Kf+Nj+ulRNK6RGxeLhtlYTyqTCdJeZUQj',
- '5lHuIAK99D2rknytEZ7tAM4u36SGlICdAanz7DxGMUFGa+xUCFmTaSfX1BJGn3Qi',
- '/vB/LMdPjrOd/7UISHH93D2fB5iX2qGxw4D3iVWUOXJunx48nduC3AFqCLDmlX6F',
- 'ongfsOBImQwgcpM3nEtYr3JWAC7D66Y6ocBXQ/OATwCbJ5jGRY6RjldMjc207iOw',
- 'HxTpZeIPHM9UyGeqd3QbKPHQquzBF8ytgssfFwGLIxhRQFwGy9kpy6l8HIHHRf7l',
- 'BQIDAQAB', '-----END PUBLIC KEY-----'
- ].join('\n');
- var publicKey = forge.pki.publicKeyFromPem(publicKeyPem);
- var signatureParentNode = 'EML/Signature';
- // test it
- var verified = box.asymmetric.service.verifyXmlSignature(
- publicKey, inStream, signatureParentNode);
- expect(verified).toBeTruthy();
- });
- });
- it('verifies the same xml as previous test, but signed with a different private key', function() {
- cryptolib('asymmetric.service', 'commons.utils', function(box) {
- var inStream = [
- '<?xml version="1.0" encoding="UTF-8"?>',
- '<EML xmlns="urn:oasis:names:tc:evs:schema:eml" xmlns:nswec="urn:nswec:events:emlExtension" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:xnl="urn:oasis:names:tc:ciq:xsdschema:xNL:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Id="410-ballots-v5-0" SchemaVersion="5.0" xsi:schemaLocation="urn:oasis:names:tc:evs:schema:eml http://docs.oasis-open.org/election/eml/v5.0/os/EML-Schemas-v5.0/410-ballots-v5-0.xsd urn:nswec:events:emlExtension http://www.elections.nsw.gov.au/standards/XML/emlcore-v5-0-NSWEC.xsd">',
- ' <TransactionId>5.04100001228337</TransactionId>',
- ' <SequenceNumber>78</SequenceNumber>',
- ' <NumberInSequence>94</NumberInSequence>',
- ' <SequencedElementName>Summer-Hill</SequencedElementName>',
- ' <ManagingAuthority>',
- ' <AuthorityIdentifier Id="EMS.ID.0007649">Returning Office for Summer Hill</AuthorityIdentifier>',
- ' <AuthorityAddress>',
- ' <xal:AddressLines>',
- ' <xal:AddressLine Type="AddressName">Summer Hill Returning Office</xal:AddressLine>',
- ' <xal:AddressLine Type="AddressLine1">Ground Floor Suite 1</xal:AddressLine>',
- ' <xal:AddressLine Type="AddressLine2">109 Jessie Street</xal:AddressLine>',
- ' <xal:AddressLine Type="LocalityName">Summer Hill</xal:AddressLine>',
- ' <xal:AddressLine Type="State">NSW</xal:AddressLine>',
- ' <xal:AddressLine Type="Postcode">2378</xal:AddressLine>',
- ' <xal:AddressLine Type="Country">Australia</xal:AddressLine>',
- ' </xal:AddressLines>',
- ' </AuthorityAddress>',
- ' <ResponsibleOfficer Id="00000000000000281210">',
- ' <Responsibility>Returning Officer for Summer Hill</Responsibility>',
- ' <Name>',
- ' <xnl:PersonName>',
- ' <xnl:FirstName>Peter</xnl:FirstName>',
- ' <xnl:LastName>Dooley</xnl:LastName>',
- ' </xnl:PersonName>',
- ' </Name>',
- ' <Contact>',
- ' <MailingAddress>',
- ' <xal:AddressLines>',
- ' <xal:AddressLine Type="AddressName">Summer Hill Returning Officer Office</xal:AddressLine>',
- ' <xal:AddressLine Type="AddressLine1">PO Box 629</xal:AddressLine>',
- ' <xal:AddressLine Type="LocalityName">Summer Hill</xal:AddressLine>',
- ' <xal:AddressLine Type="State">NSW</xal:AddressLine>',
- ' <xal:AddressLine Type="Postcode">2378</xal:AddressLine>',
- ' <xal:AddressLine Type="Country">Australia</xal:AddressLine>',
- ' </xal:AddressLines>',
- ' </MailingAddress>',
- ' <Email>RO.Summer_Hill@elections.nsw.gov.au</Email>',
- ' <Telephone Preferred="no">',
- ' <Number>0267727755</Number>',
- ' </Telephone>',
- ' <Telephone Preferred="yes">',
- ' <Number>1300135736</Number>',
- ' </Telephone>',
- ' </Contact>',
- ' </ResponsibleOfficer>',
- ' </ManagingAuthority>',
- ' <IssueDate>2014-11-17</IssueDate>',
- ' <Ballots>',
- ' <EventIdentifier Id="SG1409-078">',
- ' <EventName>Summer Hill</EventName>',
- ' <EventQualifier Id="SG1409">NSW State General Election 2014</EventQualifier>',
- ' </EventIdentifier>',
- ' <Ballot>',
- ' <Election>',
- ' <ElectionIdentifier Id="SG1409-078-01">',
- ' <ElectionName>Legislative Assembly Election</ElectionName>',
- ' <ElectionCategory>Parliamentary</ElectionCategory>',
- ' </ElectionIdentifier>',
- ' <Description>',
- ' <Message>Ballot Paper</Message>',
- ' </Description>',
- ' <Contest>',
- ' <ContestIdentifier Id="SG1409-078-01-00">',
- ' <ContestName>Summer Hill</ContestName>',
- ' </ContestIdentifier>',
- ' <HowToVote>',
- ' <Message Type="Preamble">DIRECTIONS FOR VOTING PLEASE READ CAREFULLY</Message>',
- ' <Message Type="SoleOption">Write the number 1 in the square next to the candidate of your choice. You can show more choices, if you want to, by writing numbers in the other squares, starting with the number 2.</Message>',
- ' <Message Type="SoleOption-AfterVoting">Fold this ballot paper so your vote cannot be seen and place it in the ballot box (or in the envelope provided).</Message>',
- ' </HowToVote>',
- ' <VotingMethod>OPV</VotingMethod>',
- ' <MaxVotes>7',
- '</MaxVotes>',
- ' <MinVotes>1</MinVotes>',
- ' <BallotChoices>',
- '<Candidate><CandidateIdentifier Id="1"><CandidateName>REN George</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__REN_George"><xnl:PersonName><xnl:FirstName NameType="Given Name">George</xnl:FirstName><xnl:LastName NameType="Surname">REN</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>INDEPENDENT</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="2"><CandidateName>TOMLINSON Richard</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__TOMLINSON_Richard"><xnl:PersonName><xnl:FirstName NameType="Given Name">Richard</xnl:FirstName><xnl:LastName NameType="Surname">TOMLINSON</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>DEMOCRATIC PARTY</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="3"><CandidateName>WILLIAMS Mark</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__WILLIAMS_Mark"><xnl:PersonName><xnl:FirstName NameType="Given Name">Mark</xnl:FirstName><xnl:LastName NameType="Surname">WILLIAMS</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>THE KHAKI PARTY</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="4"><CandidateName>ADCOCK Ben</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__ADCOCK_Ben"><xnl:PersonName><xnl:FirstName NameType="Given Name">Ben</xnl:FirstName><xnl:LastName NameType="Surname">ADCOCK</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>CONSERVATIVES</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="5"><CandidateName>YONG Mike</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__YONG_Mike"><xnl:PersonName><xnl:FirstName NameType="Given Name">Mike</xnl:FirstName><xnl:LastName NameType="Surname">YONG</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>AUSTRALIANS FOR ADVANCEMENT</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="6"><CandidateName>WITHERS John</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__WITHERS_John"><xnl:PersonName><xnl:FirstName NameType="Given Name">John</xnl:FirstName><xnl:LastName NameType="Surname">WITHERS</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>THE RELIGIOUS PARTY</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- '<Candidate><CandidateIdentifier Id="7"><CandidateName>CALLAGHAN Paul</CandidateName></CandidateIdentifier><CandidateFullName nswec:EventGroupUniqueId="SG1409_Summer_Hill_General_LA__CALLAGHAN_Paul"><xnl:PersonName><xnl:FirstName NameType="Given Name">Paul</xnl:FirstName><xnl:LastName NameType="Surname">CALLAGHAN</xnl:LastName></xnl:PersonName></CandidateFullName><Affiliation><AffiliationIdentifier><RegisteredName>WORKING PARTY</RegisteredName></AffiliationIdentifier><Type>Party</Type></Affiliation></Candidate>',
- ' </BallotChoices>',
- ' <nswec:ContestDescription>Election of Member of Parliamant</nswec:ContestDescription>',
- ' <nswec:NumberOfPositionsContested>1</nswec:NumberOfPositionsContested>',
- ' <nswec:PrintStatus ReprintRequired="yes">',
- ' <nswec:DrawComplete>2014-11-17T16:28:01</nswec:DrawComplete>',
- ' <nswec:Previous410/>',
- ' </nswec:PrintStatus>',
- ' </Contest>',
- ' </Election>',
- ' </Ballot>',
- ' </Ballots>',
- '<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><DigestValue>mhCdaEEiuFgKJd0sBooryGBx2b9xwsF1rlX3MSDu83c=</DigestValue></Reference></SignedInfo><SignatureValue>AKJSep65koofOLMS3qjTc1m7qdFxj9atHmMbCdjiMDhUp26kxRjuP7XEETs6njU/Hg9IdYNUAxJi',
- '0lwsK7cA0tI8MjS6JbRBXaewSTLOrZQAfqQiGJA/99qSJqPFus66XQTplzzLdzSVn7y2O4bwqU4m',
- 'knuxU4J5kI9dX+OSLl0=</SignatureValue></Signature></EML>'
- ].join('\n');
- var publicKeyPem = [
- '-----BEGIN PUBLIC KEY-----',
- 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEv0nlMpUDbILYCdCttYa6xrqN',
- 'upJeMdNjs7Z9UBLnjYYK520yuCbDGoOoUUA0FImG8rQ66xSOR7HoyZLebFS3tPuu',
- 'NCnYUIvGiMARRTLbFtE7QeGGdZRDfixtQqEznfEAY4lDb/+JsDV3gGC1pPV1kkWp',
- 'HW4qwJ35m3mseEM2dQIDAQAB', '-----END PUBLIC KEY-----'
- ].join('\n');
- var publicKey = forge.pki.publicKeyFromPem(publicKeyPem);
- var signatureParentNode = 'EML/Signature';
- // test it
- var verified = box.asymmetric.service.verifyXmlSignature(
- publicKey, inStream, signatureParentNode);
- expect(verified).toBeTruthy();
- });
- });
- });
- });
|