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

📄 sendobject.java

📁 wendang for java. 124342423 432
💻 JAVA
字号:
package javasec.samples.ch12;import java.io.*;import java.security.*;import javasec.samples.ch10.KeyStoreHandler;public class SendObject {    public static void main(String args[]) {        try {            FileOutputStream fos = new FileOutputStream("test.obj");            ObjectOutputStream oos = new ObjectOutputStream(fos);            KeyStoreHandler ksh = new KeyStoreHandler(null);            KeyStore ks = ksh.getKeyStore();            java.security.cert.Certificate certs[] =                               ks.getCertificateChain(args[0]);            PrivateKey pk = (PrivateKey) ks.getKey(args[0],                                            args[1].toCharArray());            Message m = new Message();            m.object = new SignedObject(              "This have I thought good to deliver thee, " +              "that thou mightst not lose the dues of rejoicing " +              "by being ignorant of what greatness is promised thee.",                            pk, Signature.getInstance("MD5withRSA"));            m.certificate = certs[0];            oos.writeObject(m);        } catch (Exception e) {            System.out.println(e);        }    }}

⌨️ 快捷键说明

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