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

package com.google.crypto.tink.util;

import java.security.MessageDigest;
import com.google.crypto.tink.SecretKeyAccess;
import java.math.BigInteger;
import com.google.errorprone.annotations.Immutable;

@Immutable
public final class SecretBigInteger
{
    private final BigInteger value;
    
    private SecretBigInteger(final BigInteger value) {
        this.value = value;
    }
    
    public static SecretBigInteger fromBigInteger(final BigInteger value, final SecretKeyAccess access) {
        if (access == null) {
            throw new NullPointerException("SecretKeyAccess required");
        }
        return new SecretBigInteger(value);
    }
    
    public BigInteger getBigInteger(final SecretKeyAccess access) {
        if (access == null) {
            throw new NullPointerException("SecretKeyAccess required");
        }
        return this.value;
    }
    
    public boolean equalsSecretBigInteger(final SecretBigInteger other) {
        final byte[] myArray = this.value.toByteArray();
        final byte[] otherArray = other.value.toByteArray();
        return MessageDigest.isEqual(myArray, otherArray);
    }
}
