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

📄 mystructuretest.java

📁 sip CMSEnvelopedData
💻 JAVA
字号:
package chapter5;

import java.util.Date;

import chapter4.Utils;

/**
 * Test for MyStructure
 */
public class MyStructureTest
{
    public static void main(String[] args)
        throws Exception
    {
        byte[] baseData = new byte[5];
        Date   created = new Date(0); // 1/1/1970
        
        MyStructure	structure = new MyStructure(0, created, baseData, null, null);
        
        System.out.println(Utils.toHex(structure.getEncoded()));
        if (!structure.equals(structure.toASN1Object()))
        {
            System.out.println("comparison failed.");
        }
        
        structure = new MyStructure(0, created, baseData, "hello", null);
        
        System.out.println(Utils.toHex(structure.getEncoded()));
        if (!structure.equals(structure.toASN1Object()))
        {
            System.out.println("comparison failed.");
        }
        
        structure = new MyStructure(0, created, baseData, null, "world");
        
        System.out.println(Utils.toHex(structure.getEncoded()));
        if (!structure.equals(structure.toASN1Object()))
        {
            System.out.println("comparison failed.");
        }
        
        structure = new MyStructure(0, created, baseData, "hello", "world");
        
        System.out.println(Utils.toHex(structure.getEncoded()));
        if (!structure.equals(structure.toASN1Object()))
        {
            System.out.println("comparison failed.");
        }
        
        structure = new MyStructure(1, created, baseData, null, null);
        
        System.out.println(Utils.toHex(structure.getEncoded()));
        if (!structure.equals(structure.toASN1Object()))
        {
            System.out.println("comparison failed.");
        }
    }
}

⌨️ 快捷键说明

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