All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ch.openchvote.electionauthority.writein.SecretData Maven / Gradle / Ivy

/*
 * Copyright (C) 2024 Berner Fachhochschule https://e-voting.bfh.ch
 *
 *  - This program is free software: you can redistribute it and/or modify                           -
 *  - it under the terms of the GNU Affero General Public License as published by                    -
 *  - the Free Software Foundation, either version 3 of the License, or                              -
 *  - (at your option) any later version.                                                            -
 *  -                                                                                                -
 *  - This program is distributed in the hope that it will be useful,                                -
 *  - but WITHOUT ANY WARRANTY; without even the implied warranty of                                 -
 *  - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                                   -
 *  - GNU General Public License for more details.                                                   -
 *  -                                                                                                -
 *  - You should have received a copy of the GNU Affero General Public License                       -
 *  - along with this program. If not, see .                           -
 */
package ch.openchvote.electionauthority.writein;

import ch.openchvote.algorithms.protocols.common.model.ElectionCardData;
import ch.openchvote.framework.party.EventData;
import ch.openchvote.utilities.sequence.Vector;
import ch.openchvote.utilities.tuples.Triple;
import ch.openchvote.utilities.tuples.Tuple;

import java.math.BigInteger;

/**
 * Instances of this class represent the election authority's secret data. The class inherits from the generic
 * {@link Tuple} subclass, that matches with the number of {@link EventData.Data} and {@link EventData.DataMap} objects
 * to store. Convenience methods for accessing the fields with names as specified by the CHVote protocol are provided.
 */
@SuppressWarnings("MissingJavadoc")
public final class SecretData extends Triple<
        // private keys
        EventData.Data, // sk_j
        EventData.Data>, // bold_sk_prime_j
        // election card data
        EventData.Data>> // bold_d_j
        implements EventData {

    public SecretData() {
        this(new Data<>(), new Data<>(), new Data<>());
    }

    // private constructor for initializing all fields
    private SecretData(Data sk_j, Data> bold_sk_prime_j, Data> bold_d_j) {
        super(sk_j, bold_sk_prime_j, bold_d_j);
    }

    // private copy constructor
    @SuppressWarnings("unused")
    private SecretData(SecretData secretData) {
        this(secretData.get_sk_j(), secretData.get_bold_sk_prime_j(), secretData.get_bold_d_j());
    }

    public Data get_sk_j() {
        return this.getFirst();
    }

    public Data> get_bold_sk_prime_j() {
        return this.getSecond();
    }

    public Data> get_bold_d_j() {
        return this.getThird();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy