📄 crl_list.java
字号:
/**
* @(#)CRL_LIST.java 2003/05/05
*
* Copyright(c) 2003 Wellhope Inc. All rights reserved.
*/
package psic;
/**
* @Title CRL_LIST Class
* @Description CRL_LIST类记录证书撤消列表的信息
* @Version 1.0.0
* @Author Zhuchengmin
*/
public class CRL_LIST
{
private final int MAX_TIME_SIZE = 20;//最大时间长度
private final int MAX_SN_SIZE=30;//最大序列号长度
private byte[] serialNumber;//证书序列号
private byte[] revokeTime;//发布的时间
private byte reasonCode;//证书撤销原因
public CRL_LIST next;//链接到下一个CRL
public CRL_LIST()
{
serialNumber=null;
revokeTime=null;
reasonCode=0;
next=null;
}
/* ============= 设置各项属性值 ============= */
public void setSerialNumber(byte[] b_sn)
{
serialNumber = fillBytes(b_sn, MAX_SN_SIZE);
//System.out.println("sn.size=["+b_sn.length+"]="+ MyUtil.ByteArrayToHex( serialNumber ) );
}
public void setRevokeTimeString(String s_time)
{
revokeTime = fillBytes(s_time.getBytes(),MAX_TIME_SIZE);
}
/*
public void setRevokeTimeByteArray(byte[] b_time)
{
if(b_time.length > MAX_TIME_SIZE)
revokeTime = fillBytes(b_time,MAX_TIME_SIZE);
else
revokeTime = b_time;
}
*/
public void setReasonCode(byte b_code)
{
reasonCode = b_code;
}
/* ============= 获取各项属性值 ============= */
public byte[] getSerialNumber()
{
return serialNumber;
}
public String getSerialNumberStr()
{
return byteToStr( new PKI_DATA( serialNumber ) );
}
public String getRevokeTime()
{
if(revokeTime == null)
return new String("");
else
return (new String(revokeTime)).trim();
}
public byte getReasonCode()
{
return reasonCode;
}
private byte[] fillBytes(byte[] b_in, int size)
{
byte[] b_out = new byte[size];
for(int i=0;i<size;i++)
{
if(i>=b_in.length)
b_out[i]=0;
else
b_out[i]=b_in[i];
}
return b_out;
}
//将获得的byte数组转换为全大写的字符串
public static String byteToStr(PKI_DATA serialNumber) {
int c;
String sn = "";
java.io.ByteArrayInputStream byteIn = null;
if (serialNumber != null) {
byteIn = new java.io.ByteArrayInputStream(serialNumber.getValue());
while ( (c = byteIn.read()) != -1) {
if (c < 16) {
sn += "0";
}
sn += Integer.toHexString(c).toUpperCase();
}
}
else {
return null;
}
return sn;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -