⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cryptowindow.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   CryptoWindow.java

package org.gudy.azureus2.ui.swt.auth;

import com.aelitis.azureus.core.security.*;
import java.util.Arrays;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.AESemaphore;
import org.gudy.azureus2.core3.util.Debug;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.mainwindow.*;

public class CryptoWindow
	implements CryptoManagerPasswordHandler
{
	protected class cryptoDialog
	{

		private AESemaphore sem;
		private Shell shell;
		private char password[];
		private char password2[];
		private int persist_for_secs;
		private boolean verify_password;
		final CryptoWindow this$0;

		protected void close(boolean ok)
		{
			if (!ok)
				break MISSING_BLOCK_LABEL_98;
			if (password == null)
				password = new char[0];
			if (password2 == null)
				password2 = new char[0];
			if (!verify_password || Arrays.equals(password, password2))
				break MISSING_BLOCK_LABEL_103;
			MessageBox mb = new MessageBox(shell, 33);
			mb.setText(MessageText.getString("security.crypto.password.mismatch.title"));
			mb.setMessage(MessageText.getString("security.crypto.password.mismatch"));
			mb.open();
			sem.releaseForever();
			return;
			password = null;
			shell.dispose();
			sem.releaseForever();
			break MISSING_BLOCK_LABEL_130;
			Exception exception;
			exception;
			sem.releaseForever();
			throw exception;
		}

		protected char[] getPassword()
		{
			return password;
		}

		protected int getPersistForSeconds()
		{
			return persist_for_secs;
		}




		protected cryptoDialog(AESemaphore _sem, Display display, int handler_type, int action_type, boolean last_pw_incorrect, String reason)
		{
			this$0 = CryptoWindow.this;
			Object();
			sem = _sem;
			if (display.isDisposed())
			{
				sem.releaseForever();
				return;
			}
			shell = new Shell(display, 0x10860);
			Utils.setShellIcon(shell);
			Messages.setLanguageText(shell, "security.crypto.title");
			GridLayout layout = new GridLayout();
			layout.numColumns = 3;
			shell.setLayout(layout);
			GridData gridData;
			if (action_type == 1)
			{
				Label reason_label = new Label(shell, 64);
				Messages.setLanguageText(reason_label, "security.crypto.encrypt");
				gridData = new GridData(1808);
				gridData.horizontalSpan = 3;
				gridData.widthHint = 300;
				reason_label.setLayoutData(gridData);
			} else
			{
				Label decrypt_label = new Label(shell, 64);
				Messages.setLanguageText(decrypt_label, "security.crypto.decrypt");
				gridData = new GridData(1808);
				gridData.horizontalSpan = 3;
				gridData.widthHint = 300;
				decrypt_label.setLayoutData(gridData);
				Label reason_label = new Label(shell, 0);
				Messages.setLanguageText(reason_label, "security.crypto.reason");
				gridData = new GridData(1808);
				gridData.horizontalSpan = 1;
				reason_label.setLayoutData(gridData);
				Label reason_value = new Label(shell, 0);
				reason_value.setText(reason.replaceAll("&", "&&"));
				gridData = new GridData(1808);
				gridData.horizontalSpan = 2;
				reason_value.setLayoutData(gridData);
				if (last_pw_incorrect)
				{
					Label pw_wrong_label = new Label(shell, 64);
					Messages.setLanguageText(pw_wrong_label, "security.crypto.badpw");
					gridData = new GridData(1808);
					gridData.horizontalSpan = 3;
					pw_wrong_label.setLayoutData(gridData);
					pw_wrong_label.setForeground(Colors.red);
				}
			}
			Label password_label = new Label(shell, 0);
			Messages.setLanguageText(password_label, "security.crypto.password");
			gridData = new GridData(1808);
			gridData.horizontalSpan = 1;
			password_label.setLayoutData(gridData);
			final Text password_value = new Text(shell, 2048);
			password_value.setEchoChar('*');
			password_value.setText("");
			gridData = new GridData(1808);
			gridData.horizontalSpan = 1;
			password_value.setLayoutData(gridData);
			password_value.addListener(24, new Listener() {

				final CryptoWindow val$this$0;
				final Text val$password_value;
				final cryptoDialog this$1;

				public void handleEvent(Event event)
				{
					password = password_value.getText().toCharArray();
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			new Label(shell, 0);
			if (action_type == 1)
			{
				verify_password = true;
				Label password2_label = new Label(shell, 0);
				Messages.setLanguageText(password2_label, "security.crypto.password2");
				gridData = new GridData(1808);
				gridData.horizontalSpan = 1;
				password2_label.setLayoutData(gridData);
				final Text password2_value = new Text(shell, 2048);
				password2_value.setEchoChar('*');
				password2_value.setText("");
				gridData = new GridData(1808);
				gridData.horizontalSpan = 1;
				password2_value.setLayoutData(gridData);
				password2_value.addListener(24, new Listener() {

					final CryptoWindow val$this$0;
					final Text val$password2_value;
					final cryptoDialog this$1;

					public void handleEvent(Event event)
					{
						password2 = password2_value.getText().toCharArray();
					}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
				});
				new Label(shell, 0);
			}
			Label strength_label = new Label(shell, 0);
			Messages.setLanguageText(strength_label, "security.crypto.persist_for");
			gridData = new GridData(1808);
			gridData.horizontalSpan = 1;
			strength_label.setLayoutData(gridData);
			String duration_keys[] = {
				"dont_save", "session", "day", "week", "30days", "forever"
			};
			final int duration_secs[] = {
				0, -1, 0x15180, 0x93a80, 0x278d00, 0x7fffffff
			};
			final Combo durations_combo = new Combo(shell, 12);
			for (int i = 0; i < duration_keys.length; i++)
			{
				String text = MessageText.getString((new StringBuilder()).append("security.crypto.persist_for.").append(duration_keys[i]).toString());
				durations_combo.add(text);
			}

			durations_combo.select(4);
			persist_for_secs = duration_secs[4];
			durations_combo.addListener(13, new Listener() {

				final CryptoWindow val$this$0;
				final int val$duration_secs[];
				final Combo val$durations_combo;
				final cryptoDialog this$1;

				public void handleEvent(Event e)
				{
					persist_for_secs = duration_secs[durations_combo.getSelectionIndex()];
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			gridData = new GridData(1808);
			gridData.horizontalSpan = 1;
			durations_combo.setLayoutData(gridData);
			new Label(shell, 0);
			Label linkLabel = new Label(shell, 0);
			linkLabel.setText(MessageText.getString("ConfigView.label.please.visit.here"));
			linkLabel.setData("http://www.azureuswiki.com/index.php?title=Public_Private_Keys");
			linkLabel.setCursor(Cursors.handCursor);
			linkLabel.setForeground(Colors.blue);
			gridData = new GridData();
			gridData.horizontalSpan = 3;
			linkLabel.setLayoutData(gridData);
			linkLabel.addMouseListener(new MouseAdapter() {

				final CryptoWindow val$this$0;
				final cryptoDialog this$1;

				public void mouseDoubleClick(MouseEvent arg0)
				{
					Utils.launch((String)((Label)arg0.widget).getData());
				}

				public void mouseDown(MouseEvent arg0)
				{
					Utils.launch((String)((Label)arg0.widget).getData());
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			Label labelSeparator = new Label(shell, 258);
			gridData = new GridData(768);
			gridData.horizontalSpan = 3;
			labelSeparator.setLayoutData(gridData);
			new Label(shell, 0);
			Button bOk = new Button(shell, 8);
			Messages.setLanguageText(bOk, "Button.ok");
			gridData = new GridData(896);
			gridData.grabExcessHorizontalSpace = true;
			gridData.widthHint = 70;
			bOk.setLayoutData(gridData);
			bOk.addListener(13, new Listener() {

				final CryptoWindow val$this$0;
				final cryptoDialog this$1;

				public void handleEvent(Event e)
				{
					close(true);
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			Button bCancel = new Button(shell, 8);
			Messages.setLanguageText(bCancel, "Button.cancel");
			gridData = new GridData(128);
			gridData.grabExcessHorizontalSpace = false;
			gridData.widthHint = 70;
			bCancel.setLayoutData(gridData);
			bCancel.addListener(13, new Listener() {

				final CryptoWindow val$this$0;
				final cryptoDialog this$1;

				public void handleEvent(Event e)
				{
					close(false);
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			shell.setDefaultButton(bOk);
			shell.addListener(31, new Listener() {

				final CryptoWindow val$this$0;
				final cryptoDialog this$1;

				public void handleEvent(Event e)
				{
					if (e.character == '\033')
						close(false);
				}


// JavaClassFileOutputException: Invalid index accessing method local variables table of <init>
			});
			shell.pack();
			Utils.centreWindow(shell);
			shell.open();
		}
	}


	private static final int DAY = 0x15180;

	public CryptoWindow()
	{
		CryptoManagerFactory.getSingleton().addPasswordHandler(this);
	}

	public int getHandlerType()
	{
		return 1;
	}

	public com.aelitis.azureus.core.security.CryptoManagerPasswordHandler.passwordDetails getPassword(final int handler_type, final int action_type, final boolean last_pw_incorrect, final String reason)
	{
		final Display display;
		final cryptoDialog dialog[];
		final AESemaphore sem;
		display = SWTThread.getInstance().getDisplay();
		if (display.isDisposed())
			return null;
		dialog = new cryptoDialog[1];
		sem = new AESemaphore("CryptoWindowSem");
		if (display.getThread() != Thread.currentThread())
			break MISSING_BLOCK_LABEL_113;
		display.syncExec(new Runnable() {

			final cryptoDialog val$dialog[];
			final AESemaphore val$sem;
			final Display val$display;
			final int val$handler_type;
			final int val$action_type;
			final boolean val$last_pw_incorrect;
			final String val$reason;
			final CryptoWindow this$0;

			public void run()
			{
				dialog[0] = new cryptoDialog(sem, display, handler_type, action_type, last_pw_incorrect, reason);
			}

			
			{
				this$0 = CryptoWindow.this;
				dialog = acryptodialog;
				sem = aesemaphore;
				display = display1;
				handler_type = i;
				action_type = j;
				last_pw_incorrect = flag;
				reason = s;
				Object();
			}
		});
		do
		{
			if (display.isDisposed() || sem.isReleasedForever())
				break;
			if (!display.readAndDispatch())
				display.sleep();
		} while (true);
		if (display.isDisposed())
			return null;
		break MISSING_BLOCK_LABEL_149;
		try
		{
			display.asyncExec(new Runnable() {

				final cryptoDialog val$dialog[];
				final AESemaphore val$sem;
				final Display val$display;
				final int val$handler_type;
				final int val$action_type;
				final boolean val$last_pw_incorrect;
				final String val$reason;
				final CryptoWindow this$0;

				public void run()
				{
					dialog[0] = new cryptoDialog(sem, display, handler_type, action_type, last_pw_incorrect, reason);
				}

			
			{
				this$0 = CryptoWindow.this;
				dialog = acryptodialog;
				sem = aesemaphore;
				display = display1;
				handler_type = i;
				action_type = j;
				last_pw_incorrect = flag;
				reason = s;
				Object();
			}
			});
		}
		catch (Throwable e)
		{
			Debug.printStackTrace(e);
			return null;
		}
		sem.reserve();
		final char pw[] = dialog[0].getPassword();
		final int persist_for = dialog[0].getPersistForSeconds();
		if (pw == null)
			return null;
		else
			return new com.aelitis.azureus.core.security.CryptoManagerPasswordHandler.passwordDetails() {

				final char val$pw[];
				final int val$persist_for;
				final CryptoWindow this$0;

				public char[] getPassword()
				{
					return pw;
				}

				public int getPersistForSeconds()
				{
					return persist_for;
				}

			
			{
				this$0 = CryptoWindow.this;
				pw = ac;
				persist_for = i;
				Object();
			}
			};
	}

	public void passwordOK(int i, com.aelitis.azureus.core.security.CryptoManagerPasswordHandler.passwordDetails passworddetails)
	{
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -