package com.l7tech.external.assertions.gatewaymanagement.server;

import com.l7tech.gateway.api.CertificateData;
import com.l7tech.gateway.api.ManagedObjectFactory;
import com.l7tech.gateway.api.PrivateKeyCreationContext;
import com.l7tech.gateway.api.PrivateKeyMO;
import com.l7tech.gateway.api.ManagedObjectFactory.FactoryException;
import com.l7tech.gateway.api.impl.PrivateKeyExportContext;
import com.l7tech.gateway.api.impl.PrivateKeyExportResult;
import com.l7tech.gateway.api.impl.PrivateKeyGenerateCsrContext;
import com.l7tech.gateway.api.impl.PrivateKeyGenerateCsrResult;
import com.l7tech.gateway.api.impl.PrivateKeyImportContext;
import com.l7tech.gateway.api.impl.PrivateKeySignCsrResult;
import com.l7tech.gateway.api.impl.PrivateKeySpecialPurposeContext;
import com.l7tech.gateway.common.cluster.ClusterProperty;
import com.l7tech.gateway.common.security.SpecialKeyType;
import com.l7tech.gateway.common.security.keystore.SsgKeyEntry;
import com.l7tech.gateway.common.security.rbac.OperationType;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.objectmodel.ObjectNotFoundException;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.objectmodel.SecurityZone;
import com.l7tech.objectmodel.SsgKeyHeader;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.server.DefaultKey;
import com.l7tech.server.admin.PrivateKeyAdminHelper;
import com.l7tech.server.cluster.ClusterPropertyCache;
import com.l7tech.server.cluster.ClusterPropertyManager;
import com.l7tech.server.security.keystore.SsgKeyFinder;
import com.l7tech.server.security.keystore.SsgKeyStore;
import com.l7tech.server.security.keystore.SsgKeyStoreManager;
import com.l7tech.server.security.rbac.RbacServices;
import com.l7tech.server.security.rbac.SecurityFilter;
import com.l7tech.server.security.rbac.SecurityZoneManager;
import com.l7tech.util.Config;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.Either;
import com.l7tech.util.Eithers;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.Functions;
import com.l7tech.util.GoidUpgradeMapper;
import com.l7tech.util.Option;
import com.l7tech.util.Pair;
import com.l7tech.util.TextUtils;
import com.l7tech.util.Triple;
import com.l7tech.util.Functions.NullaryVoidThrows;
import com.l7tech.util.Functions.Unary;
import java.lang.reflect.Field;
import java.security.KeyStoreException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang3.NotImplementedException;
import org.jetbrains.annotations.Nullable;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.transaction.PlatformTransactionManager;

@ResourceFactory.ResourceType(type = PrivateKeyMO.class)
public class PrivateKeyResourceFactory extends ResourceFactorySupport<PrivateKeyMO, SsgKeyEntry> {
   static final NullaryVoidThrows<ResourceFactory.InvalidResourceSelectors> g;
   static final NullaryVoidThrows<ResourceFactory.InvalidResourceException> h;
   private static final Logger i;
   private static final Set<SpecialKeyType> j;
   private static final Field k;
   private static final String l;
   private static final String m;
   private static final int n;
   private static final int o;
   private static final int p;
   private static final String q;
   private static final String r;
   private static final String s;
   private static final String t;
   private static final String u;
   private static final String v;
   private final Config w;
   private final SsgKeyStoreManager x;
   private final ClusterPropertyCache y;
   private final ClusterPropertyManager z;
   private final DefaultKey A;
   private final ApplicationEventPublisher B;
   private final SecurityZoneManager C;
   private static final String[] E;

   public PrivateKeyResourceFactory(
      RbacServices var1,
      SecurityFilter var2,
      PlatformTransactionManager var3,
      Config var4,
      SsgKeyStoreManager var5,
      ClusterPropertyCache var6,
      ClusterPropertyManager var7,
      DefaultKey var8,
      ApplicationEventPublisher var9,
      SecurityZoneManager var10
   ) {
      super(var1, var2, var3);
      this.w = var4;
      this.x = var5;
      this.y = var6;
      this.z = var7;
      this.A = var8;
      this.B = var9;
      this.C = var10;
   }

   @Override
   public EntityType getType() {
      return EntityType.SSG_KEY_ENTRY;
   }

   @Override
   public Set<String> getSelectors() {
      String[] var10002 = new String[2];
      String[] var1 = E;
      var10002[0] = var1[15];
      var10002[1] = var1[23];
      return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(var10002)));
   }

   @Override
   public boolean isReadOnly() {
      return false;
   }

   @Override
   public boolean isCreateSupported() {
      return false;
   }

   public PrivateKeyMO getResource(Map<String, String> var1) throws ResourceFactory.ResourceNotFoundException {
      return this.a(var1, Option.none());
   }

   @Override
   public Collection<Map<String, String>> getResources() {
      return (Collection<Map<String, String>>)this.transactional(new bl(this), true);
   }

   @Override
   public List<PrivateKeyMO> getResources(String var1, Boolean var2, Map<String, List<Object>> var3) {
      List var4 = (List)this.transactional(new bx(this, var3), true);
      if (var1 != null) {
         String var5 = var1;
         byte var6 = -1;

         label33: {
            try {
               switch (var5.hashCode()) {
                  case 3355:
                     if (!var5.equals(E[15])) {
                        break label33;
                     }
                     break;
                  default:
                     break label33;
               }
            } catch (IllegalArgumentException var8) {
               throw a(var8);
            }

            var6 = 0;
         }

         try {
            switch (var6) {
               case 0:
                  Collections.sort(var4, new b2(this, var2));
                  break;
               default:
                  throw new IllegalArgumentException(E[13] + var1);
            }
         } catch (IllegalArgumentException var7) {
            throw a(var7);
         }
      }

      return var4;
   }

   @Override
   public boolean resourceExists(Map<String, String> var1) {
      return (Boolean)this.transactional(new b3(this, var1), true);
   }

   public PrivateKeyMO asResource(SsgKeyEntry var1) {
      return this.a(var1, Option.none());
   }

   public final PrivateKeyMO identify(PrivateKeyMO var1, SsgKeyEntry var2) {
      var1.setId(var2.getId());
      return var1;
   }

   public SsgKeyEntry fromResource(Object var1, boolean var2) throws ResourceFactory.InvalidResourceException {
      throw new NotImplementedException(E[20]);
   }

   private PrivateKeyMO a(SsgKeyHeader var1) {
      PrivateKeyMO var2 = ManagedObjectFactory.createPrivateKey();
      var2.setAlias(var1.getAlias());
      var2.setKeystoreId(var1.getKeystoreId().toString());
      var2.setId(var1.getStrId());
      return var2;
   }

   public PrivateKeyMO putResource(Map<String, String> var1, Object var2) throws ResourceFactory.ResourceNotFoundException, ResourceFactory.InvalidResourceException {
      try {
         if (!(var2 instanceof PrivateKeyMO)) {
            throw new ResourceFactory.InvalidResourceException(ResourceFactory.InvalidResourceException.ExceptionType.UNEXPECTED_TYPE, E[30]);
         }
      } catch (ResourceFactory.ResourceNotFoundException var5) {
         throw a(var5);
      }

      PrivateKeyMO var3 = (PrivateKeyMO)var2;
      SecurityZone var4 = this.b(var3.getSecurityZoneId());
      return (PrivateKeyMO)Eithers.extract2((Either)this.transactional(new b4(this, var1, var3, var4), false));
   }

   @Override
   public String deleteResource(Map<String, String> var1) throws ResourceFactory.ResourceNotFoundException {
      return (String)Eithers.extract((Either)this.transactional(new b5(this, var1), false));
   }

   @ResourceFactory.ResourceMethod(name = "SetSpecialPurposes", resource = true, selectors = true)
   public PrivateKeyMO setSpecialPurposes(Map<String, String> var1, PrivateKeySpecialPurposeContext var2) throws ResourceFactory.ResourceNotFoundException, ResourceFactory.InvalidResourceException {
      return (PrivateKeyMO)Eithers.extract2((Either)this.transactional(new b6(this, var1, var2), false));
   }

   private void a(SpecialKeyType param1, String param2, Collection<ClusterProperty> param3, Unary<Boolean, ClusterProperty> param4) throws ObjectModelException {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.RuntimeException: parsing failure!
      //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
      //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
      //
      // Bytecode:
      // 00: aload 1
      // 01: invokestatic com/l7tech/server/admin/PrivateKeyAdminHelper.getClusterPropertyForSpecialKeyType (Lcom/l7tech/gateway/common/security/SpecialKeyType;)Ljava/lang/String;
      // 04: astore 5
      // 06: aload 0
      // 07: getfield com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.z Lcom/l7tech/server/cluster/ClusterPropertyManager;
      // 0a: aload 5
      // 0c: invokeinterface com/l7tech/server/cluster/ClusterPropertyManager.findByUniqueName (Ljava/lang/String;)Lcom/l7tech/objectmodel/PersistentEntity; 2
      // 11: checkcast com/l7tech/gateway/common/cluster/ClusterProperty
      // 14: astore 6
      // 16: aload 6
      // 18: ifnull 7c
      // 1b: aload 4
      // 1d: ifnull 40
      // 20: goto 27
      // 23: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 26: athrow
      // 27: aload 4
      // 29: aload 6
      // 2b: invokeinterface com/l7tech/util/Functions$Unary.call (Ljava/lang/Object;)Ljava/lang/Object; 2
      // 30: checkcast java/lang/Boolean
      // 33: invokevirtual java/lang/Boolean.booleanValue ()Z
      // 36: ifeq 7c
      // 39: goto 40
      // 3c: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 3f: athrow
      // 40: aload 6
      // 42: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getValue ()Ljava/lang/String;
      // 45: ifnonnull 5a
      // 48: goto 4f
      // 4b: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 4e: athrow
      // 4f: aload 2
      // 50: ifnonnull 7c
      // 53: goto 5a
      // 56: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 59: athrow
      // 5a: aload 6
      // 5c: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getValue ()Ljava/lang/String;
      // 5f: ifnull 84
      // 62: goto 69
      // 65: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 68: athrow
      // 69: aload 6
      // 6b: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getValue ()Ljava/lang/String;
      // 6e: aload 2
      // 6f: invokevirtual java/lang/String.equals (Ljava/lang/Object;)Z
      // 72: ifne 84
      // 75: goto 7c
      // 78: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 7b: athrow
      // 7c: bipush 1
      // 7d: goto 85
      // 80: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 83: athrow
      // 84: bipush 0
      // 85: istore 7
      // 87: iload 7
      // 89: ifeq c7
      // 8c: aload 6
      // 8e: ifnonnull a7
      // 91: goto 98
      // 94: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 97: athrow
      // 98: new com/l7tech/gateway/common/cluster/ClusterProperty
      // 9b: dup
      // 9c: aload 5
      // 9e: aload 2
      // 9f: invokespecial com/l7tech/gateway/common/cluster/ClusterProperty.<init> (Ljava/lang/String;Ljava/lang/String;)V
      // a2: astore 6
      // a4: goto ad
      // a7: aload 6
      // a9: aload 2
      // aa: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.setValue (Ljava/lang/String;)V
      // ad: aload 0
      // ae: aload 3
      // af: aload 5
      // b1: invokevirtual com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/util/Collection;Ljava/lang/String;)Z
      // b4: ifne c7
      // b7: aload 3
      // b8: aload 6
      // ba: invokeinterface java/util/Collection.add (Ljava/lang/Object;)Z 2
      // bf: pop
      // c0: goto c7
      // c3: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // c6: athrow
      // c7: goto ee
      // ca: astore 6
      // cc: aload 0
      // cd: aload 3
      // ce: aload 5
      // d0: invokevirtual com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/util/Collection;Ljava/lang/String;)Z
      // d3: ifne ee
      // d6: aload 3
      // d7: new com/l7tech/gateway/common/cluster/ClusterProperty
      // da: dup
      // db: aload 5
      // dd: aload 2
      // de: invokespecial com/l7tech/gateway/common/cluster/ClusterProperty.<init> (Ljava/lang/String;Ljava/lang/String;)V
      // e1: invokeinterface java/util/Collection.add (Ljava/lang/Object;)Z 2
      // e6: pop
      // e7: goto ee
      // ea: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // ed: athrow
      // ee: return
      // try (73 -> 82): 83 com/l7tech/objectmodel/FindException
      // try (56 -> 60): 61 com/l7tech/objectmodel/FindException
      // try (42 -> 52): 52 com/l7tech/objectmodel/FindException
      // try (36 -> 47): 48 com/l7tech/objectmodel/FindException
      // try (31 -> 39): 40 com/l7tech/objectmodel/FindException
      // try (25 -> 33): 34 com/l7tech/objectmodel/FindException
      // try (16 -> 28): 29 com/l7tech/objectmodel/FindException
      // try (11 -> 22): 23 com/l7tech/objectmodel/FindException
      // try (9 -> 13): 14 com/l7tech/objectmodel/FindException
      // try (3 -> 85): 86 com/l7tech/objectmodel/FindException
      // try (87 -> 100): 101 com/l7tech/objectmodel/FindException
   }

   private String a(SpecialKeyType var1, Collection<SpecialKeyType> var2, String var3) throws ObjectModelException {
      try {
         if (var2.contains(var1)) {
            return var3;
         }
      } catch (FindException var8) {
         throw a(var8);
      }

      try {
         String var4 = PrivateKeyAdminHelper.getClusterPropertyForSpecialKeyType(var1);
         ClusterProperty var5 = (ClusterProperty)this.z.findByUniqueName(var4);

         try {
            if (var5 != null) {
               return var5.getValue();
            }
         } catch (FindException var6) {
            throw a(var6);
         }

         return null;
      } catch (FindException var7) {
         return null;
      }
   }

   private boolean a(Collection<ClusterProperty> var1, String var2) {
      for (ClusterProperty var4 : var1) {
         try {
            if (var4.getName().equals(var2)) {
               return true;
            }
         } catch (IllegalArgumentException var5) {
            throw a(var5);
         }
      }

      return false;
   }

   @ResourceFactory.ResourceMethod(name = "GenerateCSR", resource = true, selectors = true)
   public PrivateKeyGenerateCsrResult generateCSR(Map<String, String> var1, PrivateKeyGenerateCsrContext var2) throws ResourceFactory.ResourceNotFoundException, ResourceFactory.InvalidResourceException {
      return (PrivateKeyGenerateCsrResult)Eithers.extract2((Either)this.transactional(new cc(this, var1, var2), true));
   }

   public PrivateKeySignCsrResult signCert(Map<String, String> var1, String var2, Integer var3, String var4, byte[] var5, String var6) throws ResourceFactory.ResourceNotFoundException, ResourceFactory.InvalidResourceException {
      return (PrivateKeySignCsrResult)Eithers.extract2((Either)this.transactional(new cd(this, var1, var5, var2, var3, var6, var4), true));
   }

   @ResourceFactory.ResourceMethod(name = "CreateKey", resource = true, selectors = true)
   public PrivateKeyMO createPrivateKey(Map<String, String> var1, PrivateKeyCreationContext var2) throws ResourceFactory.InvalidResourceException, ResourceFactory.InvalidResourceSelectors {
      Pair var3 = this.a(var1);
      SecurityZone var4 = this.b(var2.getSecurityZoneId());
      Eithers.extract((Either)this.transactional(new bn(this, var3, var2, var4), false));
      return (PrivateKeyMO)Eithers.extract((Either)this.transactional(new bo(this, var3), true));
   }

   @ResourceFactory.ResourceMethod(name = "ImportKey", resource = true, selectors = true)
   public PrivateKeyMO importPrivateKey(Map<String, String> var1, PrivateKeyImportContext var2) throws ResourceFactory.InvalidResourceException, ResourceFactory.InvalidResourceSelectors {
      return this.importPrivateKey(var1, var2, false);
   }

   public PrivateKeyMO importPrivateKey(Map<String, String> var1, PrivateKeyImportContext var2, boolean var3) throws ResourceFactory.InvalidResourceException, ResourceFactory.InvalidResourceSelectors {
      Pair var4 = this.a(var1);
      SecurityZone var5 = this.b(var2.getSecurityZoneId());
      return (PrivateKeyMO)Eithers.extract((Either)this.transactional(new bp(this, var4, var2, var5, var3), false));
   }

   @ResourceFactory.ResourceMethod(name = "ExportKey", resource = true, selectors = true)
   public PrivateKeyExportResult exportPrivateKey(Map<String, String> var1, PrivateKeyExportContext var2) throws ResourceFactory.ResourceNotFoundException {
      Pair var3 = this.a(var1);
      return (PrivateKeyExportResult)Eithers.extract((Either)this.transactional(new bq(this, var3, var2), false));
   }

   static <E extends Exception> Pair<Goid, String> a(String var0, NullaryVoidThrows<E> var1) throws E {
      return a(Collections.singletonMap(E[24], var0), var1);
   }

   static <E extends Exception> Pair<Goid, String> a(Map<String, String> var0, NullaryVoidThrows<E> var1) throws E {
      String[] var7 = E;
      String var2 = (String)var0.get(var7[12]);
      Goid var3;
      String var4;
      if (var2 == null) {
         var2 = (String)var0.get(var7[15]);

         try {
            if (var2 == null) {
               var1.call();
            }
         } catch (IllegalArgumentException var10) {
            throw a(var10);
         }

         String[] var5 = var2.split(":");

         try {
            if (var5.length != 2) {
               var1.call();
            }
         } catch (IllegalArgumentException var9) {
            throw a(var9);
         }

         try {
            var3 = GoidUpgradeMapper.mapId(EntityType.SSG_KEYSTORE, var5[0]);
         } catch (IllegalArgumentException var8) {
            var1.call();
            var3 = PersistentEntity.DEFAULT_GOID;
         }

         var4 = var5[1];
      } else {
         var3 = PersistentEntity.DEFAULT_GOID;
         var4 = var2;
      }

      return new Pair(var3, var4);
   }

   static String a(Goid var0, String var1) {
      return var0 + ":" + var1;
   }

   private PrivateKeyAdminHelper a() {
      return new PrivateKeyAdminHelper(this.A, this.x, this.B);
   }

   private Pair<Goid, String> a(Map<String, String> var1) throws ResourceFactory.InvalidResourceSelectors {
      return a(var1, g);
   }

   private PrivateKeyMO a(Map<String, String> var1, Option<Collection<SpecialKeyType>> var2) throws ResourceFactory.ResourceNotFoundException {
      return (PrivateKeyMO)Eithers.extract((Either)this.transactional(new bt(this, var1, var2), true));
   }

   private List<SsgKeyHeader> a(@Nullable List<String> param1) throws FindException {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.RuntimeException: parsing failure!
      //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
      //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
      //
      // Bytecode:
      // 00: new java/util/ArrayList
      // 03: dup
      // 04: invokespecial java/util/ArrayList.<init> ()V
      // 07: astore 2
      // 08: aload 0
      // 09: getfield com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.x Lcom/l7tech/server/security/keystore/SsgKeyStoreManager;
      // 0c: invokeinterface com/l7tech/server/security/keystore/SsgKeyStoreManager.findAll ()Ljava/util/List; 1
      // 11: invokeinterface java/util/List.iterator ()Ljava/util/Iterator; 1
      // 16: astore 3
      // 17: aload 3
      // 18: invokeinterface java/util/Iterator.hasNext ()Z 1
      // 1d: ifeq 97
      // 20: aload 3
      // 21: invokeinterface java/util/Iterator.next ()Ljava/lang/Object; 1
      // 26: checkcast com/l7tech/server/security/keystore/SsgKeyFinder
      // 29: astore 4
      // 2b: aload 4
      // 2d: invokeinterface com/l7tech/server/security/keystore/SsgKeyFinder.getAliases ()Ljava/util/List; 1
      // 32: invokeinterface java/util/List.iterator ()Ljava/util/Iterator; 1
      // 37: astore 5
      // 39: aload 5
      // 3b: invokeinterface java/util/Iterator.hasNext ()Z 1
      // 40: ifeq 94
      // 43: aload 5
      // 45: invokeinterface java/util/Iterator.next ()Ljava/lang/Object; 1
      // 4a: checkcast java/lang/String
      // 4d: astore 6
      // 4f: aload 1
      // 50: ifnull 65
      // 53: aload 1
      // 54: aload 6
      // 56: invokeinterface java/util/List.contains (Ljava/lang/Object;)Z 2
      // 5b: ifeq 91
      // 5e: goto 65
      // 61: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 64: athrow
      // 65: aload 2
      // 66: new com/l7tech/objectmodel/SsgKeyHeader
      // 69: dup
      // 6a: aload 4
      // 6c: invokeinterface com/l7tech/server/security/keystore/SsgKeyFinder.getGoid ()Lcom/l7tech/objectmodel/Goid; 1
      // 71: aload 6
      // 73: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Lcom/l7tech/objectmodel/Goid;Ljava/lang/String;)Ljava/lang/String;
      // 76: aload 4
      // 78: invokeinterface com/l7tech/server/security/keystore/SsgKeyFinder.getGoid ()Lcom/l7tech/objectmodel/Goid; 1
      // 7d: aload 6
      // 7f: aload 6
      // 81: invokespecial com/l7tech/objectmodel/SsgKeyHeader.<init> (Ljava/lang/String;Lcom/l7tech/objectmodel/Goid;Ljava/lang/String;Ljava/lang/String;)V
      // 84: invokeinterface java/util/List.add (Ljava/lang/Object;)Z 2
      // 89: pop
      // 8a: goto 91
      // 8d: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 90: athrow
      // 91: goto 39
      // 94: goto 17
      // 97: goto a4
      // 9a: astore 3
      // 9b: new com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$ResourceAccessException
      // 9e: dup
      // 9f: aload 3
      // a0: invokespecial com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$ResourceAccessException.<init> (Ljava/lang/Throwable;)V
      // a3: athrow
      // a4: aload 0
      // a5: aload 2
      // a6: getstatic com/l7tech/objectmodel/EntityType.SSG_KEY_ENTRY Lcom/l7tech/objectmodel/EntityType;
      // a9: getstatic com/l7tech/gateway/common/security/rbac/OperationType.READ Lcom/l7tech/gateway/common/security/rbac/OperationType;
      // ac: aconst_null
      // ad: invokevirtual com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.accessFilter (Ljava/util/List;Lcom/l7tech/objectmodel/EntityType;Lcom/l7tech/gateway/common/security/rbac/OperationType;Ljava/lang/String;)Ljava/util/List;
      // b0: areturn
      // try (29 -> 50): 51 java/security/KeyStoreException
      // try (27 -> 33): 34 java/security/KeyStoreException
      // try (4 -> 55): 56 java/security/KeyStoreException
      // try (4 -> 55): 56 com/l7tech/objectmodel/FindException
   }

   private PrivateKeyMO a(SsgKeyEntry var1, Option<Collection<SpecialKeyType>> var2) {
      PrivateKeyMO var3 = ManagedObjectFactory.createPrivateKey();
      var3.setId(a(var1.getKeystoreId(), var1.getAlias()));
      var3.setKeystoreId(Goid.toString(var1.getKeystoreId()));
      var3.setAlias(var1.getAlias());
      var3.setCertificateChain(this.a(var1));
      var3.setProperties(this.b(var1, var2));
      this.a(var3, var1);
      return var3;
   }

   private SsgKeyStore a(Goid var1) throws ObjectModelException {
      SsgKeyFinder var2;
      try {
         var2 = this.x.findByPrimaryKey(var1);
      } catch (KeyStoreException var6) {
         Logger var10000 = i;
         Level var10001 = Level.WARNING;
         String var10002 = ExceptionUtils.getMessage(var6);
         String[] var4 = E;
         var10000.log(var10001, var4[0] + var10002 + "'", ExceptionUtils.getDebugException(var6));
         throw new ResourceFactory.ResourceAccessException(var4[26] + ExceptionUtils.getMessage(var6));
      }

      SsgKeyStore var3 = var2.getKeyStore();

      try {
         if (var3 == null) {
            throw new UpdateException(E[22] + var1 + E[28]);
         } else {
            return var3;
         }
      } catch (KeyStoreException var5) {
         throw a(var5);
      }
   }

   private SsgKeyEntry a(Pair<Goid, String> var1) throws FindException, ResourceFactory.ResourceNotFoundException {
      Goid var2 = (Goid)var1.left;
      String var3 = (String)var1.right;
      SsgKeyEntry var4 = null;

      try {
         if (Goid.isDefault(var2)) {
            var4 = this.x.lookupKeyByKeyAlias(var3, PersistentEntity.DEFAULT_GOID);
         } else {
            SsgKeyFinder var5 = this.x.findByPrimaryKey(var2);
            var4 = var5.getCertificateChain(var3);
         }
      } catch (KeyStoreException var6) {
         throw new ResourceFactory.ResourceAccessException(var6);
      } catch (ObjectNotFoundException var7) {
      }

      try {
         if (var4 == null) {
            throw new ResourceFactory.ResourceNotFoundException(E[27] + a(var2, var3));
         }
      } catch (KeyStoreException var8) {
         throw a(var8);
      }

      ac.setEntityInfo(this.getType(), a(var2, var3));
      return var4;
   }

   public X509Certificate[] toCertificateArray(List<CertificateData> var1) throws ResourceFactory.InvalidResourceException {
      ArrayList var2 = new ArrayList();

      for (CertificateData var4 : var1) {
         var2.add(this.a(var4));
      }

      return var2.toArray(new X509Certificate[var2.size()]);
   }

   private X509Certificate a(CertificateData param1) throws ResourceFactory.InvalidResourceException {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.RuntimeException: parsing failure!
      //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
      //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
      //
      // Bytecode:
      // 00: aload 1
      // 01: ifnull 13
      // 04: aload 1
      // 05: invokevirtual com/l7tech/gateway/api/CertificateData.getEncoded ()[B
      // 08: arraylength
      // 09: ifne 27
      // 0c: goto 13
      // 0f: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 12: athrow
      // 13: new com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException
      // 16: dup
      // 17: getstatic com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType.MISSING_VALUES Lcom/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType;
      // 1a: getstatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.E [Ljava/lang/String;
      // 1d: bipush 4
      // 1e: aaload
      // 1f: invokespecial com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException.<init> (Lcom/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType;Ljava/lang/String;)V
      // 22: athrow
      // 23: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 26: athrow
      // 27: invokestatic com/l7tech/common/io/CertUtils.getFactory ()Ljava/security/cert/CertificateFactory;
      // 2a: new java/io/ByteArrayInputStream
      // 2d: dup
      // 2e: aload 1
      // 2f: invokevirtual com/l7tech/gateway/api/CertificateData.getEncoded ()[B
      // 32: invokespecial java/io/ByteArrayInputStream.<init> ([B)V
      // 35: invokevirtual java/security/cert/CertificateFactory.generateCertificate (Ljava/io/InputStream;)Ljava/security/cert/Certificate;
      // 38: astore 3
      // 39: aload 3
      // 3a: instanceof java/security/cert/X509Certificate
      // 3d: ifne 55
      // 40: new com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException
      // 43: dup
      // 44: getstatic com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType.INVALID_VALUES Lcom/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType;
      // 47: getstatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.E [Ljava/lang/String;
      // 4a: bipush 9
      // 4c: aaload
      // 4d: invokespecial com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException.<init> (Lcom/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType;Ljava/lang/String;)V
      // 50: athrow
      // 51: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 54: athrow
      // 55: aload 3
      // 56: checkcast java/security/cert/X509Certificate
      // 59: astore 2
      // 5a: goto 79
      // 5d: astore 3
      // 5e: new com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException
      // 61: dup
      // 62: getstatic com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType.INVALID_VALUES Lcom/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType;
      // 65: aload 3
      // 66: invokestatic com/l7tech/util/ExceptionUtils.getMessage (Ljava/lang/Throwable;)Ljava/lang/String;
      // 69: getstatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.E [Ljava/lang/String;
      // 6c: bipush 29
      // 6e: aaload
      // 6f: swap
      // 70: invokedynamic makeConcatWithConstants (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; bsm=java/lang/invoke/StringConcatFactory.makeConcatWithConstants (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; args=[ "\u0001\u0001" ]
      // 75: invokespecial com/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException.<init> (Lcom/l7tech/external/assertions/gatewaymanagement/server/ResourceFactory$InvalidResourceException$ExceptionType;Ljava/lang/String;)V
      // 78: athrow
      // 79: aload 2
      // 7a: areturn
      // try (27 -> 38): 38 java/security/cert/CertificateException
      // try (2 -> 17): 17 java/security/cert/CertificateException
      // try (0 -> 6): 7 java/security/cert/CertificateException
      // try (19 -> 43): 44 java/security/cert/CertificateException
   }

   private List<CertificateData> a(SsgKeyEntry var1) {
      ArrayList var2 = new ArrayList();

      for (X509Certificate var6 : var1.getCertificateChain()) {
         try {
            var2.add(ManagedObjectFactory.createCertificateData(var6));
         } catch (FactoryException var8) {
            throw new ResourceFactory.ResourceAccessException(var8);
         }
      }

      return var2;
   }

   private String b(Goid var1, String var2) {
      return a(var1, var2);
   }

   private Unary<Boolean, ClusterProperty> a(String var1) {
      return new bu(this, var1);
   }

   private void a(ClusterProperty var1, String var2) throws ObjectModelException {
      var1.setValue(var2);

      try {
         this.validate(var1);
      } catch (ResourceFactory.InvalidResourceException var4) {
         throw new ResourceFactory.ResourceAccessException(E[5], var4);
      }

      label23: {
         try {
            if (PersistentEntity.DEFAULT_GOID.equals(var1.getGoid())) {
               this.checkPermitted(OperationType.CREATE, null, var1);
               this.z.save(var1);
               break label23;
            }
         } catch (ResourceFactory.InvalidResourceException var5) {
            throw a(var5);
         }

         this.checkPermitted(OperationType.UPDATE, null, var1);
         this.z.update(var1);
      }

      this.a(var1);
   }

   private void a(ClusterProperty param1) {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.RuntimeException: parsing failure!
      //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
      //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
      //
      // Bytecode:
      // 00: aload 1
      // 01: ifnull 1f
      // 04: aload 1
      // 05: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getName ()Ljava/lang/String;
      // 08: ifnull 1f
      // 0b: goto 12
      // 0e: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 11: athrow
      // 12: getstatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.k Ljava/lang/reflect/Field;
      // 15: ifnonnull 24
      // 18: goto 1f
      // 1b: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 1e: athrow
      // 1f: return
      // 20: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 23: athrow
      // 24: aload 1
      // 25: astore 2
      // 26: getstatic com/l7tech/objectmodel/PersistentEntity.DEFAULT_GOID Lcom/l7tech/objectmodel/Goid;
      // 29: aload 1
      // 2a: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getGoid ()Lcom/l7tech/objectmodel/Goid;
      // 2d: invokevirtual com/l7tech/objectmodel/Goid.equals (Ljava/lang/Object;)Z
      // 30: ifeq 58
      // 33: aload 0
      // 34: getfield com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.z Lcom/l7tech/server/cluster/ClusterPropertyManager;
      // 37: aload 1
      // 38: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getName ()Ljava/lang/String;
      // 3b: invokeinterface com/l7tech/server/cluster/ClusterPropertyManager.findByUniqueName (Ljava/lang/String;)Lcom/l7tech/objectmodel/PersistentEntity; 2
      // 40: checkcast com/l7tech/gateway/common/cluster/ClusterProperty
      // 43: astore 3
      // 44: aload 3
      // 45: ifnull 58
      // 48: aload 3
      // 49: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getName ()Ljava/lang/String;
      // 4c: ifnull 58
      // 4f: goto 56
      // 52: invokestatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 55: athrow
      // 56: aload 3
      // 57: astore 2
      // 58: new com/l7tech/gateway/common/cluster/ImmutableClusterProperty
      // 5b: dup
      // 5c: aload 2
      // 5d: invokespecial com/l7tech/gateway/common/cluster/ImmutableClusterProperty.<init> (Lcom/l7tech/gateway/common/cluster/ClusterProperty;)V
      // 60: astore 3
      // 61: getstatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.k Ljava/lang/reflect/Field;
      // 64: aload 0
      // 65: getfield com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.y Lcom/l7tech/server/cluster/ClusterPropertyCache;
      // 68: invokevirtual java/lang/reflect/Field.get (Ljava/lang/Object;)Ljava/lang/Object;
      // 6b: checkcast java/util/concurrent/atomic/AtomicReference
      // 6e: astore 4
      // 70: aload 4
      // 72: ifnull b0
      // 75: aload 4
      // 77: invokevirtual java/util/concurrent/atomic/AtomicReference.get ()Ljava/lang/Object;
      // 7a: checkcast java/util/Map
      // 7d: astore 5
      // 7f: aload 5
      // 81: ifnull b0
      // 84: new java/util/TreeMap
      // 87: dup
      // 88: getstatic java/lang/String.CASE_INSENSITIVE_ORDER Ljava/util/Comparator;
      // 8b: invokespecial java/util/TreeMap.<init> (Ljava/util/Comparator;)V
      // 8e: astore 6
      // 90: aload 6
      // 92: aload 5
      // 94: invokeinterface java/util/Map.putAll (Ljava/util/Map;)V 2
      // 99: aload 6
      // 9b: aload 3
      // 9c: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getName ()Ljava/lang/String;
      // 9f: aload 3
      // a0: invokeinterface java/util/Map.put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; 3
      // a5: pop
      // a6: aload 4
      // a8: aload 6
      // aa: invokestatic java/util/Collections.unmodifiableMap (Ljava/util/Map;)Ljava/util/Map;
      // ad: invokevirtual java/util/concurrent/atomic/AtomicReference.set (Ljava/lang/Object;)V
      // b0: goto ce
      // b3: astore 2
      // b4: getstatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.i Ljava/util/logging/Logger;
      // b7: getstatic java/util/logging/Level.FINE Ljava/util/logging/Level;
      // ba: aload 1
      // bb: invokevirtual com/l7tech/gateway/common/cluster/ClusterProperty.getName ()Ljava/lang/String;
      // be: getstatic com/l7tech/external/assertions/gatewaymanagement/server/PrivateKeyResourceFactory.E [Ljava/lang/String;
      // c1: bipush 19
      // c3: aaload
      // c4: swap
      // c5: invokedynamic makeConcatWithConstants (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; bsm=java/lang/invoke/StringConcatFactory.makeConcatWithConstants (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; args=[ "\u0001\u0001" ]
      // ca: aload 2
      // cb: invokevirtual java/util/logging/Logger.log (Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V
      // ce: return
      // try (30 -> 35): 36 java/lang/Exception
      // try (8 -> 14): 14 java/lang/Exception
      // try (2 -> 10): 11 java/lang/Exception
      // try (0 -> 5): 6 java/lang/Exception
      // try (16 -> 77): 78 java/lang/Exception
   }

   private Map<String, Object> b(SsgKeyEntry var1, Option<Collection<SpecialKeyType>> var2) {
      HashMap var3 = new HashMap();
      Option.optional(var1.getPublic()).foreach(new bv(this, var3));
      LinkedHashSet var4 = new LinkedHashSet();
      String var5 = this.b(var1.getKeystoreId(), var1.getAlias());
      Unary var6 = this.a(var5);

      for (Triple var8 : this.a(this.c())) {
         try {
            if (((Option)var8.right).exists(var6)) {
               var4.add((SpecialKeyType)var8.left);
            }
         } catch (IllegalArgumentException var10) {
            throw a(var10);
         }
      }

      try {
         if (var2.isSome()) {
            var4.addAll((Collection)var2.some());
         }
      } catch (IllegalArgumentException var11) {
         throw a(var11);
      }

      try {
         if (!var4.isEmpty()) {
            var3.put(E[18], TextUtils.join(",", Functions.map(var4, ao.getEnumText())).toString());
         }

         return var3;
      } catch (IllegalArgumentException var9) {
         throw a(var9);
      }
   }

   private Unary<Either<FindException, Option<ClusterProperty>>, String> b() {
      return new bw(this);
   }

   private Unary<Option<ClusterProperty>, String> c() {
      return new b0(this);
   }

   private <T> Collection<Triple<SpecialKeyType, String, T>> a(Unary<T, String> var1) {
      return Functions.map(EnumSet.allOf(SpecialKeyType.class), new b1(this, var1));
   }

   private void a(PrivateKeyMO var1, SsgKeyEntry var2) {
      try {
         if (var2.getSecurityZone() != null) {
            var1.setSecurityZoneId(var2.getSecurityZone().getId());
            var1.setSecurityZone(var2.getSecurityZone().getName());
         }
      } catch (IllegalArgumentException var3) {
         throw a(var3);
      }
   }

   private SecurityZone b(String var1) throws ResourceFactory.InvalidResourceException {
      try {
         if (var1 == null || var1.isEmpty()) {
            return null;
         }
      } catch (IllegalArgumentException var9) {
         throw a(var9);
      }

      Goid var2;
      try {
         var2 = GoidUpgradeMapper.mapId(EntityType.SECURITY_ZONE, var1);
      } catch (IllegalArgumentException var6) {
         String[] var4 = E;
         throw new ResourceFactory.InvalidResourceException(ResourceFactory.InvalidResourceException.ExceptionType.INVALID_VALUES, var4[31]);
      }

      try {
         SecurityZone var3 = (SecurityZone)this.C.findByPrimaryKey(var2);

         try {
            if (var3 == null) {
               throw new ResourceFactory.InvalidResourceException(ResourceFactory.InvalidResourceException.ExceptionType.INVALID_VALUES, E[1]);
            }
         } catch (IllegalArgumentException var5) {
            throw a(var5);
         }

         try {
            if (!var3.permitsEntityType(EntityType.SSG_KEY_METADATA)) {
               throw new ResourceFactory.InvalidResourceException(ResourceFactory.InvalidResourceException.ExceptionType.INVALID_VALUES, E[8]);
            }
         } catch (IllegalArgumentException var7) {
            throw a(var7);
         }

         return var3;
      } catch (FindException var8) {
         throw new ResourceFactory.InvalidResourceException(ResourceFactory.InvalidResourceException.ExceptionType.INVALID_VALUES, E[1]);
      }
   }

   static {
      String[] var5 = new String[32];
      int var3 = 0;
      String var2 = "CGbK2I4eVuW3\u0000;a\u0015{A9\u001a!iGu\u0004g*o[fE,\u00001&Zb\u00045\u0007>hZgJ`\u001a0e@bM4\u0010u|Z~A`\u001b0`PbA.\n0\u0006cV^E-\f+@TyH%\rurZ0C%\u001dueYeW4\f'VG\u007fT%\u001b!\u007fvqG(\f\u0007cS0B)\f9b\u0018c[sK$\f1&VuV4\u00003oVqP%I1gAq)SEtE4\f1&V|Q3\u001d0t\u0015`V/\u00190tAi\u00046\b9sP0M3I<hCqH)\r\u0017eYeW4\f'VG\u007fT%\u001b!\u007fvqG(\f\u0007cS\ntFqo%\u0010\u0006oOu6c[dM4\u0010urL`A`\u0007:r\u0015`A2\u0004<rAu@`\u000f:t\u0015bA&\f'c[sA$I&cVeV)\u001d,&O\u007fJ%#s[u\\0\f6rPt\u0004%\u00076iQu@`\n0tAyB)\n4rP0P9\u00190EeZ}\n,^!cVx\n%\u0011!cG~E,G4uFuV4\u0000:hF>C!\u001d0qTiI!\u00074aP}A.\u001d{bPvE5\u0005!EFba8\u0019<tLTE9\u001aMeZ}\n,^!cVx\n%\u0011!cG~E,G4uFuV4\u0000:hF>C!\u001d0qTiI!\u00074aP}A.\u001d{bPvE5\u0005!EPbP)\u000f<eTdA\u0005\u0011%oGi`!\u0010&\u0004hT}A\u0017S[cQ0\u0019:tAu@`\u001a:tA0P9\u00190<\u0015BeZ}\n,^!cVx\n%\u0011!cG~E,G4uFuV4\u0000:hF>C!\u001d0qTiI!\u00074aP}A.\u001d{bPvE5\u0005!TFqo%\u0010\u0006oOu\u0002oQ\u0016u\\wJ!\u001d tPXE3\u0001\u0014jR\u007fV)\u001d=k\u0012u\\wJ!\u001d tPQH'\u0006'oAxI\u000fuEuG)\b9V@bT/\u001a0u,@TyH%\rurZ0V%\u000f'cFx\u0004#\b6nP0A.\u001d'\u007f\u0015vK2I%tZ`A2\u001d,<\u00157@G\u007fI`\u001b0uZeV#\fu`Zb\u0004!I%t\\fE4\fumPi\u0004)\u001auhZd\u00049\f!&\\}T,\f8c[dA$G\teTSE0\b7jP\u0013cGbK2SumPiW4\u0006'c\u0015Y``\u0004hT}A\u0002oQ\u000fbTiW\u0015\u0007!oYU\\0\u0000'\u007f\u0012MPi\u0004!\n6cFc\u0004%\u001b'iG*\u0004\u0013TPcK5\u001b6c\u0015~K4I3i@~@`\r&\\c\u00042\f4b\u0018\u007fJ,\u0010\u001bc[sK$\f1&VuV4\u00003oVqP%I0tG\u007fVzI";
      int var4 = "CGbK2I4eVuW3\u0000;a\u0015{A9\u001a!iGu\u0004g*o[fE,\u00001&Zb\u00045\u0007>hZgJ`\u001a0e@bM4\u0010u|Z~A`\u001b0`PbA.\n0\u0006cV^E-\f+@TyH%\rurZ0C%\u001dueYeW4\f'VG\u007fT%\u001b!\u007fvqG(\f\u0007cS0B)\f9b\u0018c[sK$\f1&VuV4\u00003oVqP%I1gAq)SEtE4\f1&V|Q3\u001d0t\u0015`V/\u00190tAi\u00046\b9sP0M3I<hCqH)\r\u0017eYeW4\f'VG\u007fT%\u001b!\u007fvqG(\f\u0007cS\ntFqo%\u0010\u0006oOu6c[dM4\u0010urL`A`\u0007:r\u0015`A2\u0004<rAu@`\u000f:t\u0015bA&\f'c[sA$I&cVeV)\u001d,&O\u007fJ%#s[u\\0\f6rPt\u0004%\u00076iQu@`\n0tAyB)\n4rP0P9\u00190EeZ}\n,^!cVx\n%\u0011!cG~E,G4uFuV4\u0000:hF>C!\u001d0qTiI!\u00074aP}A.\u001d{bPvE5\u0005!EFba8\u0019<tLTE9\u001aMeZ}\n,^!cVx\n%\u0011!cG~E,G4uFuV4\u0000:hF>C!\u001d0qTiI!\u00074aP}A.\u001d{bPvE5\u0005!EPbP)\u000f<eTdA\u0005\u0011%oGi`!\u0010&\u0004hT}A\u0017S[cQ0\u0019:tAu@`\u001a:tA0P9\u00190<\u0015BeZ}\n,^!cVx\n%\u0011!cG~E,G4uFuV4\u0000:hF>C!\u001d0qTiI!\u00074aP}A.\u001d{bPvE5\u0005!TFqo%\u0010\u0006oOu\u0002oQ\u0016u\\wJ!\u001d tPXE3\u0001\u0014jR\u007fV)\u001d=k\u0012u\\wJ!\u001d tPQH'\u0006'oAxI\u000fuEuG)\b9V@bT/\u001a0u,@TyH%\rurZ0V%\u000f'cFx\u0004#\b6nP0A.\u001d'\u007f\u0015vK2I%tZ`A2\u001d,<\u00157@G\u007fI`\u001b0uZeV#\fu`Zb\u0004!I%t\\fE4\fumPi\u0004)\u001auhZd\u00049\f!&\\}T,\f8c[dA$G\teTSE0\b7jP\u0013cGbK2SumPiW4\u0006'c\u0015Y``\u0004hT}A\u0002oQ\u000fbTiW\u0015\u0007!oYU\\0\u0000'\u007f\u0012MPi\u0004!\n6cFc\u0004%\u001b'iG*\u0004\u0013TPcK5\u001b6c\u0015~K4I3i@~@`\r&\\c\u00042\f4b\u0018\u007fJ,\u0010\u001bc[sK$\f1&VuV4\u00003oVqP%I0tG\u007fVzI"
         .length();
      char var1 = 26;
      int var10 = -1;

      label34:
      while (true) {
         byte var10000 = 65;
         String var10001 = var2.substring(++var10, var10 + var1);
         byte var10002 = -1;

         while (true) {
            String var14 = b(var10000, c(var10001));
            switch (var10002) {
               case 0:
                  var5[var3++] = var14;
                  if ((var10 += var1) >= var4) {
                     E = var5;
                     String[] var15 = E;
                     l = E[15];
                     q = var15[21];
                     s = var15[2];
                     t = var15[7];
                     r = var15[25];
                     m = var15[23];
                     u = var15[16];
                     v = var15[17];
                     g = new br();
                     h = new bs();
                     i = Logger.getLogger(PrivateKeyResourceFactory.class.getName());
                     j = EnumSet.of(SpecialKeyType.SSL, SpecialKeyType.SERVER_SSL, SpecialKeyType.CLIENT_SSL);

                     Field var6;
                     try {
                        String[] var12 = E;
                        var6 = ClusterPropertyCache.class.getDeclaredField(var12[6]);
                        var6.setAccessible(true);
                     } catch (NoSuchFieldException var8) {
                        var6 = null;
                        String[] var11 = E;
                        i.log(Level.WARNING, var11[3], var8);
                     }

                     k = var6;
                     String[] var13 = E;
                     n = ConfigFactory.getIntProperty(var13[11], 1825);
                     o = ConfigFactory.getIntProperty(var13[10], 730);
                     p = ConfigFactory.getIntProperty(var13[14], 2048);
                     return;
                  }

                  var1 = var2.charAt(var10);
                  break;
               default:
                  var5[var3++] = var14;
                  if ((var10 += var1) < var4) {
                     var1 = var2.charAt(var10);
                     continue label34;
                  }

                  var2 = "[uXy\u001b%\bZ-Xn\u0011'\fJh\bw\u001d(*Wc^}\u00148\t\u001ebZ<\r?\u0006Pb_rX\"\b]xZu\f(MDbFyX#\bXhZy\u00162\b";
                  var4 = "[uXy\u001b%\bZ-Xn\u0011'\fJh\bw\u001d(*Wc^}\u00148\t\u001ebZ<\r?\u0006Pb_rX\"\b]xZu\f(MDbFyX#\bXhZy\u00162\b".length();
                  var1 = 20;
                  var10 = -1;
            }

            var10000 = 121;
            var10001 = var2.substring(++var10, var10 + var1);
            var10002 = 0;
         }
      }
   }

   private static Exception a(Exception var0) {
      return var0;
   }

   private static char[] c(String var0) {
      char[] var10000 = var0.toCharArray();
      if (var10000.length < 2) {
         var10000[0] = (char)(var10000[0] ^ 20);
      }

      return var10000;
   }

   private static String b(int var0, char[] var1) {
      int var10003 = var1.length;
      int var10002 = var0;
      char[] var10001 = var1;
      int var10000 = var10003;

      for (int var2 = 0; var10000 > var2; var2++) {
         var10001[var2] = (char)(var10001[var2] ^ var10002 ^ switch (var2 % 7) {
            case 0 -> 71;
            case 1 -> 116;
            case 2 -> 81;
            case 3 -> 101;
            case 4 -> 1;
            case 5 -> 40;
            default -> 20;
         });
      }

      return new String(var10001).intern();
   }
}
