class KrbKeySetEncoder {

    public static String getASNEncodedKrbPrincipalKey(List<ActorKerberosKey> keys) throws IOException {
        ASN1Encodable[] asn1Encodables = new ASN1Encodable[keys.size()];

        for (int i = 0; i < keys.size(); i++) {
            ActorKerberosKey key = keys.get(i);
            byte[] byteValue = Base64.getDecoder().decode(key.getKeyValue().getBytes(StandardCharsets.UTF_8));
            asn1Encodables[i] = makeKrbKey(makeSalt(key.getSaltType(), key.getSaltValue()), makeEncryptionKey(key.getKeyType(), byteValue));
        }

        DERSequence krbKeys = new DERSequence(asn1Encodables);

        DERSequence krbKeySet = new DERSequence(new ASN1Encodable[]{
            // attribute-major-vno
            new DERTaggedObject(true, TAG_ATTRIBUTE_MAJOR_VNO, new DERInteger(1)),

            // attribute-minor-vno
            new DERTaggedObject(true, TAG_ATTRIBUTE_MINOR_VNO, new DERInteger(1)),

            // kvno
            new DERTaggedObject(true, TAG_KVNO, new DERInteger(1)),

            // mkvno
            new DERTaggedObject(true, TAG_MKVNO, new DERInteger(1)),

            new DERTaggedObject(true, TAG_KEYS, krbKeys)
        });
        return Base64.getEncoder().encodeToString(krbKeySet.getEncoded());
    }

    private  KrbKeySetEncoder();

}