Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'lập trình java nâng cao part 9', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chương z VẤN ĐỀ BẢO MẬT VÀ AN NINH THÔNG TIN 313 else usage if ksName null I I alias null I I inName null II outName null usage try PushbackReader console new PushbackReader new InputStreamReader System.in Keystore store Keystore.getlnstance JKS SUN Inputstream in new Fileinputstream ksName chart password - readFhssword console Keystone password store.load in password Arrays. fill password Xoámậtkhầu in.close char keyPassword - readPasswDid console Keystore password for alias PrivateKey privKey PrivateKey storé.getKey alias keyPassword Arrays.fill keypassword if privKey null error No such private key in new Fileinputstream inName CertificateFactory factory CertificateFactory.getInstance X.509 X509Certificate inCert X509Certificate factory.generateCertificate in in.close byte inCertBytes inCert.getTBSCertificate X509Certificate issuerCert X509Certificate store getCertificate alias 314 LẬP TRÌNH JAVA NÂNG CAO Principal issuer issuerCert.getSubjectDN String issuerAlg issuerCert.getSigAlgName FileOutputStream out new FileOutputStream outName X509CertInfo info new X509CertInfo inCertBytes info.set X509CertInfo.ISSUER new CertificateIssuerName X500Name issuer X509CertImpl outCert new X509CertIm.pl info outCert.sign privKey issuerAlg outCert.derEncode out out.close catch Exception e System.out.printin Error e public static char readPassword PushbackReader in String promp throws IOException System.out.print promp System.out.flush final int MAX_PASSWORD_LENGTH 100 int leng 0 chart buff new char MAX_PASSWORD_LENGTH while true int ch in.read if ch r I Ị ch n II ch -1 II ch MAX_PASSWORD_LENGTH Í if ch r 7 DOS xem như kết thúc dòng r n ch in.read Chuang 7. VẤN ĐỂ BẢO MẬT VÀ AN NINH THÔNG TIN 315 if ch n ch -1 in. unread ch ỉ char password new char leng System.arraycopy buff 0 password 0 leng Arrays.fill buff return password else buff leng char ch leng public static void usage System.out.printin Usage java CertificateSigner -keystore keystore - alias issuerKeyAlias -infile .