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
OIDTest.java
Package: security.rar [view]
Upload User: lior1029
Upload Date: 2013-05-07
Package Size: 209k
Code Size: 1k
Category:
CA program
Development Platform:
Java
- package org.bouncycastle.asn1.test;
- import java.io.*;
- import org.bouncycastle.util.encoders.*;
- import org.bouncycastle.util.test.*;
- import org.bouncycastle.asn1.*;
- import org.bouncycastle.asn1.pkcs.*;
- /**
- * X.690 test example
- */
- public class OIDTest
- implements Test
- {
- byte[] req = Hex.decode("0603813403");
- public String getName()
- {
- return "OID";
- }
- public TestResult perform()
- {
- try
- {
- ByteArrayInputStream bIn = new ByteArrayInputStream(req);
- DERInputStream dIn = new DERInputStream(bIn);
- DERObjectIdentifier o = new DERObjectIdentifier("2.100.3");
- ByteArrayOutputStream bOut = new ByteArrayOutputStream();
- DEROutputStream dOut = new DEROutputStream(bOut);
- dOut.writeObject(o);
- byte[] bytes = bOut.toByteArray();
- if (bytes.length != req.length)
- {
- return new SimpleTestResult(false, getName() + ": failed length test");
- }
- for (int i = 0; i != req.length; i++)
- {
- if (bytes[i] != req[i])
- {
- return new SimpleTestResult(false, getName() + ": failed comparison test");
- }
- }
- }
- catch (Exception e)
- {
- return new SimpleTestResult(false, getName() + ": Exception - " + e.toString());
- }
- return new SimpleTestResult(true, getName() + ": Okay");
- }
- public static void main(
- String[] args)
- {
- Test test = new OIDTest();
- TestResult result = test.perform();
- System.out.println(result);
- }
- }