Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
JCEInstallTest.java
Package: BouncyCastleTest.rar [view]
Upload User: mbg588933
Upload Date: 2022-08-05
Package Size: 10k
Code Size: 1k
Category:
Crypt_Decrypt algrithms
Development Platform:
Java
- import javax.crypto.*;
- public class JCEInstallTest{
- public static final String stringToEncrypt="This is a test.";
- public static void main(String[] args) throws Exception{
- System.out.print("Attempting to get a Blowfish key...");
- KeyGenerator keyGenerator=KeyGenerator.getInstance("Blowfish");
- keyGenerator.init(128);
- SecretKey key=keyGenerator.generateKey();
- System.out.println("OK "+ key.getAlgorithm());
- System.out.println("Attempting to get a Cipher and encrypt...");
- Cipher cipher=Cipher.getInstance("Blowfish/ECB/PKCS5Padding");
- cipher.init(Cipher.ENCRYPT_MODE,key);
- byte[] cipherText=cipher.doFinal(stringToEncrypt.getBytes("UTF8"));
- System.out.println("OK");
- System.out.println("Test completed successfully.");
- }
- }