コード例 #1
0
 public override void verify(java.security.PublicKey arg0, java.lang.String arg1)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::java.security.cert.Certificate_._verify14970, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::java.security.cert.Certificate_.staticClass, global::java.security.cert.Certificate_._verify14970, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1));
     }
 }
コード例 #2
0
 public PrivilegedExceptionActionAnonymousInnerClassHelper(Signer outerInstance, java.security.PublicKey pub)
 {
     this.OuterInstance = outerInstance;
     this.Pub           = pub;
 }
コード例 #3
0
ファイル: blala.cs プロジェクト: fboas/OutlawzChecker
        public static string check(string proxy, string combo)
        {
            try
            {
                HttpRequest vlient = new HttpRequest();
                JArray      lol    =
                    JArray.Parse(
                        JObject.Parse(vlient.Get("http://apresolve.spotify.com/?type=accesspoint").ToString())[
                            "accesspoint"].ToString());
                TcpClient clinet = null;
                Random    random = new Random();

                string host = lol[random.Next(0, lol.Count)].ToString();

                if (proxy == "null")
                {
                    clinet = new TcpClient(host.Split(':')[0], int.Parse(host.Split(':')[1]));
                }
                else
                {
                    clinet = ProxyTcpClient(host.Split(':')[0], int.Parse(host.Split(':')[1]), proxy.Split(':')[0], int.Parse(proxy.Split(':')[1]));
                }
                //clinet = new TcpClient(host.Split(':')[0], int.Parse(host.Split(':')[1]));
                if (clinet == null)
                {
                    return("error");
                }

                clinet.ReceiveTimeout = 4000;
                clinet.SendTimeout    = 4000;
                com.JB.crypto.DiffieHellman keys = new com.JB.crypto.DiffieHellman(new java.util.Random());
                byte[]      clientHello          = com.JB.core.Session.clientHello(keys);
                Accumulator acc = new Accumulator();

                var a = clinet.GetStream();
                a.WriteByte(0x00);
                a.WriteByte(0x04);
                a.WriteByte(0x00);
                a.WriteByte(0x00);
                a.WriteByte(0x00);
                a.Flush();
                int    lenght = 2 + 4 + clientHello.Length;
                byte[] bytes  = BitConverter.GetBytes(lenght);
                a.WriteByte(bytes[0]);
                a.Write(clientHello, 0, clientHello.Length);
                a.Flush();
                Byte[] buffer = new byte[1000];
                int    len    = int.Parse(a.Read(buffer, 0, buffer.Length).ToString());
                byte[] tmp    = new byte[len];
                Array.Copy(buffer, tmp, len);

                tmp = tmp.Skip(4).ToArray();

                acc.writeByte(0x00);
                acc.writeByte(0x04);
                acc.writeInt(lenght);
                acc.write(clientHello);
                acc.writeInt(len);
                acc.write(tmp);
                acc.dump();

                com.spotify.Keyexchange.APResponseMessage apResponseMessage =
                    com.spotify.Keyexchange.APResponseMessage.parseFrom(tmp);
                byte[] sharedKey = com.JB.common.Utils.toByteArray(keys.computeSharedKey(apResponseMessage
                                                                                         .getChallenge().getLoginCryptoChallenge().getDiffieHellman().getGs().toByteArray()));

                java.security.KeyFactory factory   = java.security.KeyFactory.getInstance("RSA");
                java.security.PublicKey  publicKey = factory.generatePublic(
                    new java.security.spec.RSAPublicKeySpec(new java.math.BigInteger(1, serverKey),
                                                            java.math.BigInteger.valueOf(65537)));
                java.security.Signature sig = java.security.Signature.getInstance("SHA1withRSA");
                sig.initVerify(publicKey);
                sig.update(apResponseMessage.getChallenge().getLoginCryptoChallenge().getDiffieHellman().getGs()
                           .toByteArray());
                sig.verify(apResponseMessage.getChallenge().getLoginCryptoChallenge().getDiffieHellman()
                           .getGsSignature().toByteArray());

                java.io.ByteArrayOutputStream data = new java.io.ByteArrayOutputStream(100);

                javax.crypto.Mac mac = javax.crypto.Mac.getInstance("HmacSHA1");
                mac.init(new javax.crypto.spec.SecretKeySpec(sharedKey, "HmacSHA1"));
                for (int i = 1; i < 6; i++)
                {
                    mac.update(acc.array());
                    mac.update(new byte[] { (byte)i });
                    data.write(mac.doFinal());
                    mac.reset();
                }

                byte[] dataArray = data.toByteArray();
                mac = javax.crypto.Mac.getInstance("HmacSHA1");
                mac.init(new javax.crypto.spec.SecretKeySpec(java.util.Arrays.copyOfRange(dataArray, 0, 0x14),
                                                             "HmacSHA1"));
                mac.update(acc.array());
                byte[] challenge = mac.doFinal();

                com.spotify.Keyexchange.ClientResponsePlaintext clientResponsePlaintext = com.spotify.Keyexchange
                                                                                          .ClientResponsePlaintext.newBuilder()
                                                                                          .setLoginCryptoResponse(com.spotify.Keyexchange.LoginCryptoResponseUnion.newBuilder()
                                                                                                                  .setDiffieHellman(com.spotify.Keyexchange.LoginCryptoDiffieHellmanResponse.newBuilder()
                                                                                                                                    .setHmac(com.google.protobuf.ByteString.copyFrom(challenge)).build())
                                                                                                                  .build())
                                                                                          .setPowResponse(com.spotify.Keyexchange.PoWResponseUnion.newBuilder().build())
                                                                                          .setCryptoResponse(com.spotify.Keyexchange.CryptoResponseUnion.newBuilder().build())
                                                                                          .build();

                byte[] clientResponsePlaintextBytes = clientResponsePlaintext.toByteArray();
                len = 4 + clientResponsePlaintextBytes.Length;
                a.WriteByte(0x00);
                a.WriteByte(0x00);
                a.WriteByte(0x00);
                byte[] bytesb = BitConverter.GetBytes(len);
                a.WriteByte(bytesb[0]);
                a.Write(clientResponsePlaintextBytes, 0, clientResponsePlaintextBytes.Length);
                a.Flush();

                com.spotify.Authentication.LoginCredentials loginCredentials = com.spotify.Authentication
                                                                               .LoginCredentials.newBuilder()
                                                                               .setUsername(combo.Split(':')[0])
                                                                               .setTyp(com.spotify.Authentication.AuthenticationType.AUTHENTICATION_USER_PASS)
                                                                               .setAuthData(com.google.protobuf.ByteString.copyFromUtf8(combo.Split(':')[1]))
                                                                               .build();

                com.spotify.Authentication.ClientResponseEncrypted clientResponseEncrypted = com.spotify.Authentication
                                                                                             .ClientResponseEncrypted.newBuilder()
                                                                                             .setLoginCredentials(loginCredentials)
                                                                                             .setSystemInfo(com.spotify.Authentication.SystemInfo.newBuilder()
                                                                                                            .setOs(com.spotify.Authentication.Os.OS_UNKNOWN)
                                                                                                            .setCpuFamily(com.spotify.Authentication.CpuFamily.CPU_UNKNOWN)
                                                                                                            .setSystemInformationString(com.JB.Version.systemInfoString())
                                                                                                            .setDeviceId(com.JB.common.Utils.randomHexString(new java.util.Random(), 30))
                                                                                                            .build())
                                                                                             .setVersionString(com.JB.Version.versionString())
                                                                                             .build();

                com.JB.crypto.Shannon sendCipher = new com.JB.crypto.Shannon();
                sendCipher.key(java.util.Arrays.copyOfRange(data.toByteArray(), 0x14, 0x34));
                AtomicInteger sendNonce = new AtomicInteger(0);

                com.JB.crypto.Shannon recvCipher = new com.JB.crypto.Shannon();
                recvCipher.key(java.util.Arrays.copyOfRange(data.toByteArray(), 0x34, 0x54));
                AtomicInteger recvNonce = new AtomicInteger(0);
                sendCipher.nonce(com.JB.common.Utils.toByteArray(sendNonce.getAndIncrement()));

                java.nio.ByteBuffer buffer2 =
                    java.nio.ByteBuffer.allocate(1 + 2 + clientResponseEncrypted.toByteArray().Length);
                buffer2.put(com.JB.crypto.Packet.Type.Login.val)
                .putShort((short)clientResponseEncrypted.toByteArray().Length)
                .put(clientResponseEncrypted.toByteArray());

                byte[] bytess = buffer2.array();
                sendCipher.encrypt(bytess);
                byte[] macc = new byte[4];
                sendCipher.finish(macc);
                a.Write(bytess, 0, bytess.Length);
                a.Write(macc, 0, macc.Length);
                a.Flush();
                recvCipher.nonce(com.JB.common.Utils.toByteArray(recvNonce.getAndIncrement()));

                byte[] headerBytes = new byte[3];
                a.Read(headerBytes, 0, 3);
                recvCipher.decrypt(headerBytes);

                short  payloadLength = (short)((headerBytes[1] << 8) | (headerBytes[2] & 0xFF));
                byte[] payloadBytes  = new byte[payloadLength];
                a.Read(payloadBytes, 0, payloadBytes.Length);
                recvCipher.decrypt(payloadBytes);

                byte[] maccc = new byte[4];
                a.Read(maccc, 0, maccc.Length);
                if (headerBytes[0] == 172)
                {
                    com.spotify.Authentication.APWelcome apWelcome = com.spotify.Authentication.APWelcome.parseFrom(payloadBytes);

                    int    i    = 0;
                    string lel  = "";
                    string lel2 = "";
                    while (true)
                    {
                        recvCipher.nonce(com.JB.common.Utils.toByteArray(recvNonce.getAndIncrement()));

                        headerBytes = new byte[3];
                        a.Read(headerBytes, 0, 3);
                        recvCipher.decrypt(headerBytes);

                        payloadLength = (short)((headerBytes[1] << 8) | (headerBytes[2] & 0xFF));
                        payloadBytes  = new byte[payloadLength];
                        a.Read(payloadBytes, 0, payloadBytes.Length);
                        Thread.Sleep(10);
                        recvCipher.decrypt(payloadBytes);
                        maccc = new byte[4];
                        a.Read(maccc, 0, maccc.Length);

                        //File.WriteAllBytes(headerBytes[0]+".txt",payloadBytes);
                        if (headerBytes[0] == 27)
                        {
                            System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
                            lel2 = enc.GetString(payloadBytes);
                            i++;
                        }
                        if (headerBytes[0] == 80)
                        {
                            Console.WriteLine(com.JB.core.Session.parse(payloadBytes).get("financial-product").ToString());
                            lel = com.JB.core.Session.parse(payloadBytes).get("financial-product").ToString();
                            i++;
                        }

                        if (i >= 2)
                        {
                            return(lel + "-lol-" + apWelcome + "-lol-" + lel2);
                        }
                    }
                }
                else if (headerBytes[0] == 173)
                {
                    return("invalid");
                }
            }
            catch (Exception ex)
            {
                return("error");
            }

            return("error");
        }
コード例 #4
0
 public abstract void verify(java.security.PublicKey arg0, java.lang.String arg1);
コード例 #5
0
 public abstract void verify(java.security.PublicKey arg0);
コード例 #6
0
 public VerifierInfo(string packageName, java.security.PublicKey publicKey)
 {
     throw new System.NotImplementedException();
 }