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

package com.google.crypto.tink.hybrid;

import com.google.crypto.tink.aead.AeadKeyTemplates;
import com.google.crypto.tink.proto.EciesAeadDemParams;
import com.google.protobuf.ByteString;
import com.google.crypto.tink.proto.EciesHkdfKemParams;
import com.google.crypto.tink.proto.EciesAeadHkdfParams;
import com.google.crypto.tink.proto.EciesAeadHkdfKeyFormat;
import com.google.crypto.tink.proto.OutputPrefixType;
import com.google.crypto.tink.proto.EcPointFormat;
import com.google.crypto.tink.proto.HashType;
import com.google.crypto.tink.proto.EllipticCurveType;
import com.google.crypto.tink.proto.KeyTemplate;

public final class HybridKeyTemplates
{
    private static final byte[] EMPTY_SALT;
    public static final KeyTemplate ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM;
    public static final KeyTemplate ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM_COMPRESSED_WITHOUT_PREFIX;
    public static final KeyTemplate ECIES_P256_HKDF_HMAC_SHA256_AES128_CTR_HMAC_SHA256;
    
    @Deprecated
    public static KeyTemplate createEciesAeadHkdfKeyTemplate(final EllipticCurveType curve, final HashType hashType, final EcPointFormat ecPointFormat, final KeyTemplate demKeyTemplate, final OutputPrefixType outputPrefixType, final byte[] salt) {
        final EciesAeadHkdfKeyFormat format = EciesAeadHkdfKeyFormat.newBuilder().setParams(createEciesAeadHkdfParams(curve, hashType, ecPointFormat, demKeyTemplate, salt)).build();
        return KeyTemplate.newBuilder().setTypeUrl(EciesAeadHkdfPrivateKeyManager.getKeyType()).setOutputPrefixType(outputPrefixType).setValue(format.toByteString()).build();
    }
    
    @Deprecated
    public static EciesAeadHkdfParams createEciesAeadHkdfParams(final EllipticCurveType curve, final HashType hashType, final EcPointFormat ecPointFormat, final KeyTemplate demKeyTemplate, final byte[] salt) {
        final EciesHkdfKemParams kemParams = EciesHkdfKemParams.newBuilder().setCurveType(curve).setHkdfHashType(hashType).setHkdfSalt(ByteString.copyFrom(salt)).build();
        final EciesAeadDemParams demParams = EciesAeadDemParams.newBuilder().setAeadDem(demKeyTemplate).build();
        return EciesAeadHkdfParams.newBuilder().setKemParams(kemParams).setDemParams(demParams).setEcPointFormat(ecPointFormat).build();
    }
    
    private HybridKeyTemplates() {
    }
    
    static {
        EMPTY_SALT = new byte[0];
        ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM = createEciesAeadHkdfKeyTemplate(EllipticCurveType.NIST_P256, HashType.SHA256, EcPointFormat.UNCOMPRESSED, AeadKeyTemplates.AES128_GCM, OutputPrefixType.TINK, HybridKeyTemplates.EMPTY_SALT);
        ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM_COMPRESSED_WITHOUT_PREFIX = createEciesAeadHkdfKeyTemplate(EllipticCurveType.NIST_P256, HashType.SHA256, EcPointFormat.COMPRESSED, AeadKeyTemplates.AES128_GCM, OutputPrefixType.RAW, HybridKeyTemplates.EMPTY_SALT);
        ECIES_P256_HKDF_HMAC_SHA256_AES128_CTR_HMAC_SHA256 = createEciesAeadHkdfKeyTemplate(EllipticCurveType.NIST_P256, HashType.SHA256, EcPointFormat.UNCOMPRESSED, AeadKeyTemplates.AES128_CTR_HMAC_SHA256, OutputPrefixType.TINK, HybridKeyTemplates.EMPTY_SALT);
    }
}
