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

package com.google.crypto.tink.jwt;

import com.google.crypto.tink.Parameters;
import com.google.crypto.tink.Key;
import com.google.crypto.tink.AccessesPartialKey;
import com.google.errorprone.annotations.RestrictedApi;
import java.security.GeneralSecurityException;
import com.google.crypto.tink.util.SecretBigInteger;
import com.google.crypto.tink.signature.EcdsaPrivateKey;
import com.google.errorprone.annotations.Immutable;

@Immutable
public final class JwtEcdsaPrivateKey extends JwtSignaturePrivateKey
{
    public final JwtEcdsaPublicKey publicKey;
    private final EcdsaPrivateKey ecdsaPrivateKey;
    
    @RestrictedApi(explanation = "Accessing parts of keys can produce unexpected incompatibilities, annotate the function with @AccessesPartialKey", link = "https://developers.google.com/tink/design/access_control#accessing_partial_keys", allowedOnPath = ".*Test\\.java", allowlistAnnotations = { AccessesPartialKey.class })
    @AccessesPartialKey
    public static JwtEcdsaPrivateKey create(final JwtEcdsaPublicKey publicKey, final SecretBigInteger privateValue) throws GeneralSecurityException {
        final EcdsaPrivateKey ecdsaPrivateKey = EcdsaPrivateKey.builder().setPublicKey(publicKey.getEcdsaPublicKey()).setPrivateValue(privateValue).build();
        return new JwtEcdsaPrivateKey(publicKey, ecdsaPrivateKey);
    }
    
    private JwtEcdsaPrivateKey(final JwtEcdsaPublicKey publicKey, final EcdsaPrivateKey ecdsaPrivateKey) {
        this.publicKey = publicKey;
        this.ecdsaPrivateKey = ecdsaPrivateKey;
    }
    
    @RestrictedApi(explanation = "Accessing parts of keys can produce unexpected incompatibilities, annotate the function with @AccessesPartialKey", link = "https://developers.google.com/tink/design/access_control#accessing_partial_keys", allowedOnPath = ".*Test\\.java", allowlistAnnotations = { AccessesPartialKey.class })
    @AccessesPartialKey
    public SecretBigInteger getPrivateValue() {
        return this.ecdsaPrivateKey.getPrivateValue();
    }
    
    @Override
    public JwtEcdsaParameters getParameters() {
        return this.publicKey.getParameters();
    }
    
    @Override
    public JwtEcdsaPublicKey getPublicKey() {
        return this.publicKey;
    }
    
    @Override
    public boolean equalsKey(final Key o) {
        if (!(o instanceof JwtEcdsaPrivateKey)) {
            return false;
        }
        final JwtEcdsaPrivateKey that = (JwtEcdsaPrivateKey)o;
        return that.publicKey.equalsKey(this.publicKey) && this.ecdsaPrivateKey.equalsKey(that.ecdsaPrivateKey);
    }
    
    @RestrictedApi(explanation = "Accessing parts of keys can produce unexpected incompatibilities, annotate the function with @AccessesPartialKey", link = "https://developers.google.com/tink/design/access_control#accessing_partial_keys", allowedOnPath = ".*Test\\.java", allowlistAnnotations = { AccessesPartialKey.class })
    EcdsaPrivateKey getEcdsaPrivateKey() {
        return this.ecdsaPrivateKey;
    }
}
