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

package org.bouncycastle.pqc.crypto.crystals.dilithium;

import java.security.SecureRandom;
import org.bouncycastle.util.Arrays;

public class DilithiumPrivateKeyParameters extends DilithiumKeyParameters
{
    final byte[] rho;
    final byte[] k;
    final byte[] tr;
    final byte[] s1;
    final byte[] s2;
    final byte[] t0;
    private final byte[] t1;
    
    public DilithiumPrivateKeyParameters(final DilithiumParameters dilithiumParameters, final byte[] array, final byte[] array2, final byte[] array3, final byte[] array4, final byte[] array5, final byte[] array6, final byte[] array7) {
        super(true, dilithiumParameters);
        this.rho = Arrays.clone(array);
        this.k = Arrays.clone(array2);
        this.tr = Arrays.clone(array3);
        this.s1 = Arrays.clone(array4);
        this.s2 = Arrays.clone(array5);
        this.t0 = Arrays.clone(array6);
        this.t1 = Arrays.clone(array7);
    }
    
    public DilithiumPrivateKeyParameters(final DilithiumParameters dilithiumParameters, final byte[] array, final DilithiumPublicKeyParameters dilithiumPublicKeyParameters) {
        super(true, dilithiumParameters);
        final DilithiumEngine engine = dilithiumParameters.getEngine(null);
        int n = 0;
        this.rho = Arrays.copyOfRange(array, 0, 32);
        n += 32;
        this.k = Arrays.copyOfRange(array, n, n + 32);
        n += 32;
        this.tr = Arrays.copyOfRange(array, n, n + 64);
        n += 64;
        final int n2 = engine.getDilithiumL() * engine.getDilithiumPolyEtaPackedBytes();
        this.s1 = Arrays.copyOfRange(array, n, n + n2);
        final int n3 = n + n2;
        final int n4 = engine.getDilithiumK() * engine.getDilithiumPolyEtaPackedBytes();
        this.s2 = Arrays.copyOfRange(array, n3, n3 + n4);
        final int n5 = n3 + n4;
        this.t0 = Arrays.copyOfRange(array, n5, n5 + engine.getDilithiumK() * 416);
        if (dilithiumPublicKeyParameters != null) {
            this.t1 = dilithiumPublicKeyParameters.getT1();
        }
        else {
            this.t1 = null;
        }
    }
    
    public byte[] getEncoded() {
        return Arrays.concatenate(new byte[][] { this.rho, this.k, this.tr, this.s1, this.s2, this.t0 });
    }
    
    public byte[] getK() {
        return Arrays.clone(this.k);
    }
    
    @Deprecated
    public byte[] getPrivateKey() {
        return this.getEncoded();
    }
    
    public byte[] getPublicKey() {
        return DilithiumPublicKeyParameters.getEncoded(this.rho, this.t1);
    }
    
    public DilithiumPublicKeyParameters getPublicKeyParameters() {
        return new DilithiumPublicKeyParameters(this.getParameters(), this.rho, this.t1);
    }
    
    public byte[] getRho() {
        return Arrays.clone(this.rho);
    }
    
    public byte[] getS1() {
        return Arrays.clone(this.s1);
    }
    
    public byte[] getS2() {
        return Arrays.clone(this.s2);
    }
    
    public byte[] getT0() {
        return Arrays.clone(this.t0);
    }
    
    public byte[] getT1() {
        return Arrays.clone(this.t1);
    }
    
    public byte[] getTr() {
        return Arrays.clone(this.tr);
    }
}
