// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.crypto.params;

import org.bouncycastle.util.BigIntegers;
import org.bouncycastle.util.Arrays;
import org.bouncycastle.asn1.x9.X9ECParameters;
import java.security.SecureRandom;
import org.bouncycastle.crypto.Digest;
import org.bouncycastle.math.ec.ECPoint;
import java.math.BigInteger;
import org.bouncycastle.crypto.KeyGenerationParameters;

public class ECCSIKeyGenerationParameters extends KeyGenerationParameters
{
    private final BigInteger q;
    private final ECPoint G;
    private final Digest digest;
    private final byte[] id;
    private final BigInteger ksak;
    private final ECPoint kpak;
    private final int n;
    
    public ECCSIKeyGenerationParameters(final SecureRandom secureRandom, final X9ECParameters x9ECParameters, final Digest digest, final byte[] array) {
        super(secureRandom, x9ECParameters.getCurve().getA().bitLength());
        this.q = x9ECParameters.getCurve().getOrder();
        this.G = x9ECParameters.getG();
        this.digest = digest;
        this.id = Arrays.clone(array);
        this.n = x9ECParameters.getCurve().getA().bitLength();
        this.ksak = BigIntegers.createRandomBigInteger(this.n, secureRandom).mod(this.q);
        this.kpak = this.G.multiply(this.ksak).normalize();
    }
    
    public byte[] getId() {
        return Arrays.clone(this.id);
    }
    
    public ECPoint getKPAK() {
        return this.kpak;
    }
    
    public BigInteger computeSSK(final BigInteger val) {
        return this.ksak.add(val).mod(this.q);
    }
    
    public BigInteger getQ() {
        return this.q;
    }
    
    public ECPoint getG() {
        return this.G;
    }
    
    public Digest getDigest() {
        return this.digest;
    }
    
    public int getN() {
        return this.n;
    }
}
