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

package org.bouncycastle.pqc.crypto.lms;

import org.bouncycastle.crypto.Digest;

public class LMSContext implements Digest
{
    private final byte[] C;
    private final LMOtsPrivateKey key;
    private final LMSigParameters sigParams;
    private final byte[][] path;
    private final LMOtsPublicKey publicKey;
    private final Object signature;
    private LMSSignedPubKey[] signedPubKeys;
    private volatile Digest digest;
    
    LMSContext(final LMOtsPrivateKey key, final LMSigParameters sigParams, final Digest digest, final byte[] c, final byte[][] path) {
        this.key = key;
        this.sigParams = sigParams;
        this.digest = digest;
        this.C = c;
        this.path = path;
        this.publicKey = null;
        this.signature = null;
    }
    
    LMSContext(final LMOtsPublicKey publicKey, final Object signature, final Digest digest) {
        this.publicKey = publicKey;
        this.signature = signature;
        this.digest = digest;
        this.C = null;
        this.key = null;
        this.sigParams = null;
        this.path = null;
    }
    
    byte[] getC() {
        return this.C;
    }
    
    byte[] getQ() {
        final byte[] array = new byte[34];
        this.digest.doFinal(array, 0);
        this.digest = null;
        return array;
    }
    
    byte[][] getPath() {
        return this.path;
    }
    
    LMOtsPrivateKey getPrivateKey() {
        return this.key;
    }
    
    LMOtsPublicKey getPublicKey() {
        return this.publicKey;
    }
    
    LMSigParameters getSigParams() {
        return this.sigParams;
    }
    
    public Object getSignature() {
        return this.signature;
    }
    
    LMSSignedPubKey[] getSignedPubKeys() {
        return this.signedPubKeys;
    }
    
    LMSContext withSignedPublicKeys(final LMSSignedPubKey[] signedPubKeys) {
        this.signedPubKeys = signedPubKeys;
        return this;
    }
    
    @Override
    public String getAlgorithmName() {
        return this.digest.getAlgorithmName();
    }
    
    @Override
    public int getDigestSize() {
        return this.digest.getDigestSize();
    }
    
    @Override
    public void update(final byte b) {
        this.digest.update(b);
    }
    
    @Override
    public void update(final byte[] array, final int n, final int n2) {
        this.digest.update(array, n, n2);
    }
    
    @Override
    public int doFinal(final byte[] array, final int n) {
        return this.digest.doFinal(array, n);
    }
    
    @Override
    public void reset() {
        this.digest.reset();
    }
}
