package com.l7tech.server.bundling;

import com.l7tech.gateway.common.security.keystore.SsgKeyEntry;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.server.security.keystore.SsgKeyStore;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;

class v implements Callable<String> {
   final SsgKeyEntry val$ssgKeyEntry;
   final boolean val$replaceMatchingCertChainIfRequired;
   final u this$1;
   private static final String a;

   v(u var1, SsgKeyEntry var2, boolean var3) {
      this.this$1 = var1;
      this.val$ssgKeyEntry = var2;
      this.val$replaceMatchingCertChainIfRequired = var3;
   }

   public String call() throws Exception {
      SsgKeyStore var1 = this.this$1.this$0.a(this.val$ssgKeyEntry.getKeystoreId());
      Future var2 = var1.storePrivateKeyEntry(true, null, this.val$ssgKeyEntry, false, this.val$replaceMatchingCertChainIfRequired);

      try {
         if (!(Boolean)var2.get()) {
            throw new ObjectModelException(a + this.val$ssgKeyEntry.getId());
         } else {
            return null;
         }
      } catch (Exception var3) {
         throw a(var3);
      }
   }

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

   static {
      String var10002 = a(
         38, a(")}\u0019e\u0013T\u0004\u0018{\u000eg\u0011\u0000\f\u0002hK~\u000eT\u0016\ry\u000e*\u0000T\u0015\u001ef\u001dk\u0015\u0011E\u0007j\u00120A")
      );
      byte var10001 = -1;
      a = var10002;
   }

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

      return var10000;
   }

   private static String a(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 -> 74;
            case 1 -> 41;
            case 2 -> 77;
            case 3 -> 44;
            case 4 -> 71;
            case 5 -> 82;
            default -> 67;
         });
      }

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