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


Java DERGeneralizedTime类代码示例

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


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

示例1: getInstance

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的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.DERGeneralizedTime; //导入依赖的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: PrivateKeyUsagePeriod

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的package包/类
private PrivateKeyUsagePeriod(ASN1Sequence seq)
{
    Enumeration en = seq.getObjects();
    while (en.hasMoreElements())
    {
        ASN1TaggedObject tObj = (ASN1TaggedObject)en.nextElement();

        if (tObj.getTagNo() == 0)
        {
            _notBefore = DERGeneralizedTime.getInstance(tObj, false);
        }
        else if (tObj.getTagNo() == 1)
        {
            _notAfter = DERGeneralizedTime.getInstance(tObj, false);
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:PrivateKeyUsagePeriod.java

示例4: CrlID

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的package包/类
private CrlID(
    ASN1Sequence    seq)
{
    Enumeration    e = seq.getObjects();

    while (e.hasMoreElements())
    {
        ASN1TaggedObject    o = (ASN1TaggedObject)e.nextElement();

        switch (o.getTagNo())
        {
        case 0:
            crlUrl = DERIA5String.getInstance(o, true);
            break;
        case 1:
            crlNum = ASN1Integer.getInstance(o, true);
            break;
        case 2:
            crlTime = DERGeneralizedTime.getInstance(o, true);
            break;
        default:
            throw new IllegalArgumentException(
                    "unknown tag number: " + o.getTagNo());
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:CrlID.java

示例5: makeOcspResponsesID

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的package包/类
/**
 * make OcspResponsesID from BasicOCSPResp
 * 
 * @param ocspResp
 * @return OcspResponsesID
 * @throws NoSuchAlgorithmException
 * @throws OCSPException
 * @throws IOException
 */
private OcspResponsesID makeOcspResponsesID(BasicOCSPResp ocspResp)
		throws NoSuchAlgorithmException, OCSPException, IOException {

	Digest digest = DigestFactory.getInstance().factoryDefault();
	digest.setAlgorithm(DigestAlgorithmEnum.SHA_256);

	byte[] digestValue = digest.digest(ocspResp.getEncoded());
	OtherHash hash = new OtherHash(digestValue);

	OcspResponsesID ocsprespid = new OcspResponsesID(new OcspIdentifier(
			ocspResp.getResponderId().toASN1Object(),
			new DERGeneralizedTime(ocspResp.getProducedAt())), hash);

	return ocsprespid;
}
 
开发者ID:demoiselle,项目名称:signer,代码行数:25,代码来源:RevocationRefs.java

示例6: Time

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的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

示例7: getInstance

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的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

示例8: getInstance

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的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

示例9: getDate

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的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

示例10: checkConstruction

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的package包/类
private void checkConstruction(
    DeclarationOfMajority decl,
    int                   type,
    DERGeneralizedTime    dateOfBirth,
    int                   notYoungerThan)
    throws IOException
{
    checkValues(decl, type, dateOfBirth, notYoungerThan);

    decl = DeclarationOfMajority.getInstance(decl);

    checkValues(decl, type, dateOfBirth, notYoungerThan);

    ASN1InputStream aIn = new ASN1InputStream(decl.toASN1Object().getEncoded());

    DERTaggedObject info = (DERTaggedObject)aIn.readObject();

    decl = DeclarationOfMajority.getInstance(info);

    checkValues(decl, type, dateOfBirth, notYoungerThan);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:22,代码来源:DeclarationOfMajorityUnitTest.java

示例11: checkConstruction

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的package包/类
private void checkConstruction(
    PersonalData data,
    NameOrPseudonym nameOrPseudonym,
    BigInteger nameDistinguisher,
    DERGeneralizedTime dateOfBirth,
    DirectoryString placeOfBirth,
    String gender,
    DirectoryString postalAddress)
    throws IOException
{
    checkValues(data, nameOrPseudonym, nameDistinguisher, dateOfBirth, placeOfBirth, gender, postalAddress);

    data = PersonalData.getInstance(data);

    checkValues(data, nameOrPseudonym, nameDistinguisher, dateOfBirth, placeOfBirth, gender, postalAddress);

    ASN1InputStream aIn = new ASN1InputStream(data.toASN1Object().getEncoded());

    ASN1Sequence seq = (ASN1Sequence)aIn.readObject();

    data = PersonalData.getInstance(seq);

    checkValues(data, nameOrPseudonym, nameDistinguisher, dateOfBirth, placeOfBirth, gender, postalAddress);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:25,代码来源:PersonalDataUnitTest.java

示例12: checkValues

import org.bouncycastle.asn1.DERGeneralizedTime; //导入依赖的package包/类
private void checkValues(
    PersonalData data,
    NameOrPseudonym nameOrPseudonym,
    BigInteger nameDistinguisher,
    DERGeneralizedTime dateOfBirth,
    DirectoryString placeOfBirth,
    String gender,
    DirectoryString postalAddress)
{
    checkMandatoryField("nameOrPseudonym", nameOrPseudonym, data.getNameOrPseudonym());
    checkOptionalField("nameDistinguisher", nameDistinguisher, data.getNameDistinguisher());
    checkOptionalField("dateOfBirth", dateOfBirth, data.getDateOfBirth());
    checkOptionalField("placeOfBirth", placeOfBirth, data.getPlaceOfBirth());
    checkOptionalField("gender", gender, data.getGender());
    checkOptionalField("postalAddress", postalAddress, data.getPostalAddress());
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:17,代码来源:PersonalDataUnitTest.java


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