publickeypromptencryptionhandler.java
来自「Java生成PDF Java生成PDF Java生成PDF」· Java 代码 · 共 53 行
JAVA
53 行
// $Id: PublicKeyPromptEncryptionHandler.java,v 1.5 2007/11/05 14:54:57 mike Exp $package org.faceless.pdf2.viewer2;import org.faceless.pdf2.*;import javax.swing.*;import javax.security.auth.x500.X500Principal;import java.math.BigInteger;import java.awt.*;import java.util.*;import java.security.*;import java.io.*;/** * An extension of the {@link PublicKeyEncryptionHandler} that will pop up a * dialog allowing the user to select a KeyStore to select a private key from * if necessary. * <p><i>This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.</i></p> * @since 2.8.2 */public class PublicKeyPromptEncryptionHandler extends PublicKeyEncryptionHandler{ private Component parent; private KeyStoreManager manager; private String alias; private transient char[] password; private boolean selected; public PublicKeyPromptEncryptionHandler(Component parent, KeyStoreManager manager) { this.parent = parent; this.manager = manager; } public void setAlias(String alias, char[] password) { this.alias = alias; this.password = password; } protected boolean chooseRecipient(X500Principal[] issuers, BigInteger[] serials) { Object[] o = new Object[issuers.length]; for (int i=0;i<o.length;i++) { o[i] = new Object[] { issuers[i], serials[i] }; } Map out = manager.showDecryptionKeySelectionDialog(alias, password, o); if (out!=null) { alias = (String)out.get("Alias"); password = (char[])out.get("Password"); } setDecryptionKey(manager.getKeyStore(), alias, password); return true; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?