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

package com.google.crypto.tink;

import com.google.crypto.tink.proto.KeysetInfo;
import java.io.IOException;
import java.security.GeneralSecurityException;

public final class LegacyKeysetSerialization
{
    public static KeysetHandle parseKeysetWithoutSecret(final KeysetReader reader) throws GeneralSecurityException, IOException {
        return KeysetHandle.readNoSecret(reader);
    }
    
    public static KeysetHandle parseKeyset(final KeysetReader reader, final SecretKeyAccess access) throws GeneralSecurityException, IOException {
        if (access == null) {
            throw new NullPointerException("SecretKeyAccess cannot be null");
        }
        return CleartextKeysetHandle.read(reader);
    }
    
    public static KeysetHandle parseEncryptedKeyset(final KeysetReader reader, final Aead aead, final byte[] associatedData) throws GeneralSecurityException, IOException {
        return KeysetHandle.readWithAssociatedData(reader, aead, associatedData);
    }
    
    public static void serializeKeysetWithoutSecret(final KeysetHandle keysetHandle, final KeysetWriter writer) throws GeneralSecurityException, IOException {
        keysetHandle.writeNoSecret(writer);
    }
    
    public static void serializeKeyset(final KeysetHandle keysetHandle, final KeysetWriter writer, final SecretKeyAccess access) throws IOException {
        if (access == null) {
            throw new NullPointerException("SecretKeyAccess cannot be null");
        }
        CleartextKeysetHandle.write(keysetHandle, writer);
    }
    
    public static void serializeEncryptedKeyset(final KeysetHandle keysetHandle, final KeysetWriter writer, final Aead aead, final byte[] associatedData) throws GeneralSecurityException, IOException {
        keysetHandle.writeWithAssociatedData(writer, aead, associatedData);
    }
    
    public static KeysetInfo getKeysetInfo(final KeysetHandle handle) {
        return handle.getKeysetInfo();
    }
    
    private LegacyKeysetSerialization() {
    }
}
