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


Java DirectoryString类代码示例

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


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

示例1: getInstance

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
public static NameOrPseudonym getInstance(Object obj)
{
    if (obj == null || obj instanceof NameOrPseudonym)
    {
        return (NameOrPseudonym)obj;
    }

    if (obj instanceof ASN1String)
    {
        return new NameOrPseudonym(DirectoryString.getInstance(obj));
    }

    if (obj instanceof ASN1Sequence)
    {
        return new NameOrPseudonym((ASN1Sequence)obj);
    }

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

示例2: NameOrPseudonym

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
/**
 * Constructor from ASN1Sequence.
 * <p/>
 * The sequence is of type NameOrPseudonym:
 * <p/>
 * <pre>
 *       NameOrPseudonym ::= CHOICE {
 *            surAndGivenName SEQUENCE {
 *              surName DirectoryString,
 *              givenName SEQUENCE OF DirectoryString
 *         },
 *            pseudonym DirectoryString
 *       }
 * </pre>
 *
 * @param seq The ASN.1 sequence.
 */
private NameOrPseudonym(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }

    if (!(seq.getObjectAt(0) instanceof ASN1String))
    {
        throw new IllegalArgumentException("Bad object encountered: "
            + seq.getObjectAt(0).getClass());
    }

    surname = DirectoryString.getInstance(seq.getObjectAt(0));
    givenName = ASN1Sequence.getInstance(seq.getObjectAt(1));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:35,代码来源:NameOrPseudonym.java

示例3: NameOrPseudonym

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
/**
 * Constructor from ASN1Sequence.
 * <p>
 * The sequence is of type NameOrPseudonym:
 * <pre>
 *       NameOrPseudonym ::= CHOICE {
 *            surAndGivenName SEQUENCE {
 *              surName DirectoryString,
 *              givenName SEQUENCE OF DirectoryString
 *         },
 *            pseudonym DirectoryString
 *       }
 * </pre>
 * </p>
 * @param seq The ASN.1 sequence.
 */
private NameOrPseudonym(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }

    if (!(seq.getObjectAt(0) instanceof ASN1String))
    {
        throw new IllegalArgumentException("Bad object encountered: "
            + seq.getObjectAt(0).getClass());
    }

    surname = DirectoryString.getInstance(seq.getObjectAt(0));
    givenName = ASN1Sequence.getInstance(seq.getObjectAt(1));
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:34,代码来源:NameOrPseudonym.java

示例4: ProfessionInfo

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
/**
 * Constructor from given details.
 * <p>
 * <code>professionItems</code> is mandatory, all other parameters are
 * optional.
 *
 * @param namingAuthority    The naming authority.
 * @param professionItems    Directory strings of the profession.
 * @param professionOIDs     DERObjectIdentfier objects for the
 *                           profession.
 * @param registrationNumber Registration number.
 * @param addProfessionInfo  Additional infos in encoded form.
 */
public ProfessionInfo(NamingAuthority namingAuthority,
                      DirectoryString[] professionItems, ASN1ObjectIdentifier[] professionOIDs,
                      String registrationNumber, ASN1OctetString addProfessionInfo)
{
    this.namingAuthority = namingAuthority;
    ASN1EncodableVector v = new ASN1EncodableVector();
    for (int i = 0; i != professionItems.length; i++)
    {
        v.add(professionItems[i]);
    }
    this.professionItems = new DERSequence(v);
    if (professionOIDs != null)
    {
        v = new ASN1EncodableVector();
        for (int i = 0; i != professionOIDs.length; i++)
        {
            v.add(professionOIDs[i]);
        }
        this.professionOIDs = new DERSequence(v);
    }
    this.registrationNumber = registrationNumber;
    this.addProfessionInfo = addProfessionInfo;
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:37,代码来源:ProfessionInfo.java

示例5: checkConstruction

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
private void checkConstruction(
    NamingAuthority auth,
    ASN1ObjectIdentifier namingAuthorityID,
    String              namingAuthorityURL,
    DirectoryString     namingAuthorityText)
    throws IOException
{
    checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);

    auth = NamingAuthority.getInstance(auth);

    checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);

    ASN1InputStream aIn = new ASN1InputStream(auth.toASN1Primitive().getEncoded());

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

    auth = NamingAuthority.getInstance(seq);

    checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:22,代码来源:NamingAuthorityUnitTest.java

示例6: checkConstruction

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
private void checkConstruction(
    ProcurationSyntax procuration,
    String country,
    DirectoryString  typeOfSubstitution,
    GeneralName thirdPerson,
    IssuerSerial certRef)
    throws IOException
{
    checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef);

    procuration = ProcurationSyntax.getInstance(procuration);

    checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef);

    ASN1InputStream aIn = new ASN1InputStream(procuration.toASN1Primitive().getEncoded());

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

    procuration = ProcurationSyntax.getInstance(seq);

    checkValues(procuration, country, typeOfSubstitution, thirdPerson, certRef);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:23,代码来源:ProcurationSyntaxUnitTest.java

示例7: checkConstruction

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
private void checkConstruction(
    ProfessionInfo profInfo,
    NamingAuthority auth,
    DirectoryString[] professionItems,
    ASN1ObjectIdentifier[] professionOids,
    String registrationNumber,
    DEROctetString addProfInfo)
    throws IOException
{
    checkValues(profInfo, auth, professionItems, professionOids, registrationNumber, addProfInfo);

    profInfo = ProfessionInfo.getInstance(profInfo);

    checkValues(profInfo, auth, professionItems, professionOids, registrationNumber, addProfInfo);

    ASN1InputStream aIn = new ASN1InputStream(profInfo.toASN1Primitive().getEncoded());

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

    profInfo = ProfessionInfo.getInstance(seq);

    checkValues(profInfo, auth, professionItems, professionOids, registrationNumber, addProfInfo);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:24,代码来源:ProfessionInfoUnitTest.java

示例8: checkValues

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
private void checkValues(
    ProfessionInfo profInfo,
    NamingAuthority auth,
    DirectoryString[] professionItems,
    ASN1ObjectIdentifier[] professionOids,
    String registrationNumber,
    DEROctetString addProfInfo)
{
    checkOptionalField("auth", auth, profInfo.getNamingAuthority());
    checkMandatoryField("professionItems", professionItems[0], profInfo.getProfessionItems()[0]);
    if (professionOids != null)
    {
        checkOptionalField("professionOids", professionOids[0], profInfo.getProfessionOIDs()[0]);
    }
    checkOptionalField("registrationNumber", registrationNumber, profInfo.getRegistrationNumber());
    checkOptionalField("addProfessionInfo", addProfInfo, profInfo.getAddProfessionInfo());
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:18,代码来源:ProfessionInfoUnitTest.java

示例9: performTest

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
public void performTest()
    throws Exception
{
    AdditionalInformationSyntax syntax = new AdditionalInformationSyntax("hello world");

    checkConstruction(syntax, new DirectoryString("hello world"));

    try
    {
        AdditionalInformationSyntax.getInstance(new Object());

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:19,代码来源:AdditionalInformationSyntaxUnitTest.java

示例10: performTest

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
public void performTest()
    throws Exception
{
    DirectoryString res = new DirectoryString("test");
    Restriction restriction = new Restriction(res.getString());

    checkConstruction(restriction, res);

    try
    {
        Restriction.getInstance(new Object());

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:20,代码来源:RestrictionUnitTest.java

示例11: parse

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
@Override
public void parse(ASN1Primitive derObject) {
    ASN1Sequence derSequence = ASN1Object.getDERSequence(derObject);
    ASN1Primitive firstObject = derSequence.getObjectAt(0).toASN1Primitive();
    this.policyName = new DirectoryString(firstObject.toString());
    ASN1Primitive secondObject = derSequence.getObjectAt(1).toASN1Primitive();
    String fieldOfApplication = secondObject.toString();
    this.fieldOfApplication = new DirectoryString(fieldOfApplication);
    this.signingPeriod = new SigningPeriod();
    this.signingPeriod.parse(derSequence.getObjectAt(2).toASN1Primitive());

    int indice = 3;
    ASN1Primitive revocationObject = derSequence.getObjectAt(indice).toASN1Primitive();
    if (!(secondObject instanceof DERTaggedObject)) {
        indice = 4;
    }
    if (indice == 3) {
        this.revocationDate = new Time();
        this.revocationDate.parse(revocationObject);
    }
}
 
开发者ID:demoiselle,项目名称:signer,代码行数:22,代码来源:PolicyInfo.java

示例12: ProfessionInfo

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
/**
 * Constructor from given details.
 * <p/>
 * <code>professionItems</code> is mandatory, all other parameters are
 * optional.
 *
 * @param namingAuthority    The naming authority.
 * @param professionItems    Directory strings of the profession.
 * @param professionOIDs     DERObjectIdentfier objects for the
 *                           profession.
 * @param registrationNumber Registration number.
 * @param addProfessionInfo  Additional infos in encoded form.
 */
public ProfessionInfo(NamingAuthority namingAuthority,
                      DirectoryString[] professionItems, ASN1ObjectIdentifier[] professionOIDs,
                      String registrationNumber, ASN1OctetString addProfessionInfo)
{
    this.namingAuthority = namingAuthority;
    ASN1EncodableVector v = new ASN1EncodableVector();
    for (int i = 0; i != professionItems.length; i++)
    {
        v.add(professionItems[i]);
    }
    this.professionItems = new DERSequence(v);
    if (professionOIDs != null)
    {
        v = new ASN1EncodableVector();
        for (int i = 0; i != professionOIDs.length; i++)
        {
            v.add(professionOIDs[i]);
        }
        this.professionOIDs = new DERSequence(v);
    }
    this.registrationNumber = registrationNumber;
    this.addProfessionInfo = addProfessionInfo;
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:37,代码来源:ProfessionInfo.java

示例13: checkConstruction

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的package包/类
private void checkConstruction(
    NamingAuthority auth,
    DERObjectIdentifier namingAuthorityID,
    String              namingAuthorityURL,
    DirectoryString     namingAuthorityText)
    throws IOException
{
    checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);

    auth = NamingAuthority.getInstance(auth);

    checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);

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

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

    auth = NamingAuthority.getInstance(seq);

    checkValues(auth, namingAuthorityID, namingAuthorityURL, namingAuthorityText);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:22,代码来源:NamingAuthorityUnitTest.java

示例14: checkConstruction

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

示例15: checkValues

import org.bouncycastle.asn1.x500.DirectoryString; //导入依赖的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.x500.DirectoryString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。