当前位置: 首页>>代码示例>>Java>>正文


Java DERUTCTime类代码示例

本文整理汇总了Java中org.bouncycastle.asn1.DERUTCTime的典型用法代码示例。如果您正苦于以下问题:Java DERUTCTime类的具体用法?Java DERUTCTime怎么用?Java DERUTCTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DERUTCTime类属于org.bouncycastle.asn1包,在下文中一共展示了DERUTCTime类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInstance

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
public static Time getInstance(
    Object  obj)
{
    if (obj == null || obj instanceof Time)
    {
        return (Time)obj;
    }
    else if (obj instanceof DERUTCTime)
    {
        return new Time((DERUTCTime)obj);
    }
    else if (obj instanceof DERGeneralizedTime)
    {
        return new Time((DERGeneralizedTime)obj);
    }

    throw new IllegalArgumentException("unknown object in factory: " + obj.getClass().getName());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:Time.java

示例2: getDate

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
public Date getDate()
{
    try
    {
        if (time instanceof DERUTCTime)
        {
            return ((DERUTCTime)time).getAdjustedDate();
        }
        else
        {
            return ((DERGeneralizedTime)time).getDate();
        }
    }
    catch (ParseException e)
    {         // this should never happen
        throw new IllegalStateException("invalid date string: " + e.getMessage());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:Time.java

示例3: parse

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
@Override
public void parse(ASN1Primitive derObject) {
    if (derObject instanceof ASN1GeneralizedTime) {
        ASN1GeneralizedTime derGeneralizedTime = (ASN1GeneralizedTime) derObject;
        try {
            this.setTime(derGeneralizedTime.getDate());
        } catch (ParseException ex) {
            this.setTime(null);
        }
    } else if (derObject instanceof DERUTCTime) {
        DERUTCTime derUTCTime = (DERUTCTime) derObject;
        try {
            this.setTime(derUTCTime.getDate());
        } catch (ParseException exception) {
            this.setTime(null);
        }
    }
}
 
开发者ID:demoiselle,项目名称:signer,代码行数:19,代码来源:Time.java

示例4: getMicrosoftCrlNextPublish

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
/**
 * Get Microsoft CRL Next Publish (1.3.6.1.4.1.311.21.4) extension value as a string.
 * 
 * @param bValue The octet string value
 * @return Extension value as a string
 * @throws IOException If an I/O problem occurs
 */
private String getMicrosoftCrlNextPublish(byte[] bValue)
    throws IOException
{
	DERUTCTime time = (DERUTCTime) ASN1Primitive.fromByteArray(bValue);
	String date = time.getAdjustedTime();
	try
	{
		date = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(time.getAdjustedDate());
	}
	catch (ParseException e)
	{
		// Ignored
	}
	return escapeHtml(date);
}
 
开发者ID:gavioto,项目名称:portecle,代码行数:23,代码来源:X509Ext.java

示例5: Time

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
/**
 * Creates a time object from a given date - if the date is between 1950
 * and 2049 a UTCTime object is generated, otherwise a GeneralizedTime
 * is used.
 *
 * @param time a date object representing the time of interest.
 */
public Time(
    Date    time)
{
    SimpleTimeZone      tz = new SimpleTimeZone(0, "Z");
    SimpleDateFormat    dateF = new SimpleDateFormat("yyyyMMddHHmmss");

    dateF.setTimeZone(tz);

    String  d = dateF.format(time) + "Z";
    int     year = Integer.parseInt(d.substring(0, 4));

    if (year < 1950 || year > 2049)
    {
        this.time = new DERGeneralizedTime(d);
    }
    else
    {
        this.time = new DERUTCTime(d.substring(2));
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:28,代码来源:Time.java

示例6: getInstance

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
public static Time getInstance(
    Object  obj)
{
    if (obj instanceof Time)
    {
        return (Time)obj;
    }
    else if (obj instanceof DERUTCTime)
    {
        return new Time((DERUTCTime)obj);
    }
    else if (obj instanceof DERGeneralizedTime)
    {
        return new Time((DERGeneralizedTime)obj);
    }

    throw new IllegalArgumentException("unknown object in factory");
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:19,代码来源:Time.java

示例7: getInstance

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
/**
 * Return a Time object from the given object.
 * <p>
 * Accepted inputs:
 * <ul>
 * <li> null &rarr; null
 * <li> {@link Time} object
 * <li> {@link org.bouncycastle.asn1.DERUTCTime DERUTCTime} object
 * <li> {@link org.bouncycastle.asn1.DERGeneralizedTime DERGeneralizedTime} object
 * </ul>
 *
 * @param obj the object we want converted.
 * @exception IllegalArgumentException if the object cannot be converted.
 */
public static Time getInstance(
    Object  obj)
{
    if (obj == null || obj instanceof Time)
    {
        return (Time)obj;
    }
    else if (obj instanceof DERUTCTime)
    {
        return new Time((DERUTCTime)obj);
    }
    else if (obj instanceof DERGeneralizedTime)
    {
        return new Time((DERGeneralizedTime)obj);
    }

    throw new IllegalArgumentException("unknown object in factory: " + obj.getClass().getName());
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:33,代码来源:Time.java

示例8: getDate

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
/**
 * Get java.util.Date version of date+time.
 */
public Date getDate()
{
    try
    {
        if (time instanceof DERUTCTime)
        {
            return ((DERUTCTime)time).getAdjustedDate();
        }
        else
        {
            return ((DERGeneralizedTime)time).getDate();
        }
    }
    catch (ParseException e)
    {         // this should never happen
        throw new IllegalStateException("invalid date string: " + e.getMessage());
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:22,代码来源:Time.java

示例9: Time

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
public Time(
    ASN1Primitive   time)
{
    if (!(time instanceof DERUTCTime)
        && !(time instanceof DERGeneralizedTime))
    {
        throw new IllegalArgumentException("unknown object passed to Time");
    }

    this.time = time; 
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:Time.java

示例10: getTime

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
public String getTime()
{
    if (time instanceof DERUTCTime)
    {
        return ((DERUTCTime)time).getAdjustedTime();
    }
    else
    {
        return ((DERGeneralizedTime)time).getTime();
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:Time.java

示例11: createSigningTime

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
private Attribute createSigningTime(Date now) {
	final DEREncodableVector setEV = new DEREncodableVector();
	setEV.add(new DERUTCTime(now));

	DERSet set = new DERSet(setEV);
	Attribute seq1 = new Attribute(
			new DERObjectIdentifier(ID_SIGNING_TIME), set);
	return seq1;
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:10,代码来源:DerEncoder.java

示例12: createSigningTime

import org.bouncycastle.asn1.DERUTCTime; //导入依赖的package包/类
private Attribute createSigningTime(Date now) {
	final ASN1EncodableVector setEV = new ASN1EncodableVector();
	setEV.add(new DERUTCTime(now));

	DERSet set = new DERSet(setEV);
	Attribute seq1 = new Attribute(
			new ASN1ObjectIdentifier(ID_SIGNING_TIME), set);
	return seq1;
}
 
开发者ID:bluecrystalsign,项目名称:signer-source,代码行数:10,代码来源:DerEncoder.java


注:本文中的org.bouncycastle.asn1.DERUTCTime类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。