Java 类org.bouncycastle.asn1.isismtt.x509.NamingAuthority 实例源码

项目:gwt-crypto    文件:NamingAuthorityUnitTest.java   
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);
}
项目:gwt-crypto    文件:AdmissionsUnitTest.java   
private void checkConstruction(
    Admissions      admissions,
    GeneralName     name,
    NamingAuthority auth)
    throws IOException
{
    checkValues(admissions, name, auth);

    admissions = Admissions.getInstance(admissions);

    checkValues(admissions, name, auth);

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

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

    admissions = Admissions.getInstance(info);

    checkValues(admissions, name, auth);
}
项目:gwt-crypto    文件:ProfessionInfoUnitTest.java   
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);
}
项目:gwt-crypto    文件:ProfessionInfoUnitTest.java   
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());
}
项目:irma_future_id    文件:NamingAuthorityUnitTest.java   
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);
}
项目:irma_future_id    文件:AdmissionsUnitTest.java   
private void checkConstruction(
    Admissions      admissions,
    GeneralName     name,
    NamingAuthority auth)
    throws IOException
{
    checkValues(admissions, name, auth);

    admissions = Admissions.getInstance(admissions);

    checkValues(admissions, name, auth);

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

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

    admissions = Admissions.getInstance(info);

    checkValues(admissions, name, auth);
}
项目:irma_future_id    文件:ProfessionInfoUnitTest.java   
private void checkConstruction(
    ProfessionInfo profInfo,
    NamingAuthority auth,
    DirectoryString[] professionItems,
    DERObjectIdentifier[] 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.toASN1Object().getEncoded());

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

    profInfo = ProfessionInfo.getInstance(seq);

    checkValues(profInfo, auth, professionItems, professionOids, registrationNumber, addProfInfo);
}
项目:irma_future_id    文件:ProfessionInfoUnitTest.java   
private void checkValues(
    ProfessionInfo profInfo,
    NamingAuthority auth,
    DirectoryString[] professionItems,
    DERObjectIdentifier[] 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());
}
项目:bc-java    文件:NamingAuthorityUnitTest.java   
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);
}
项目:bc-java    文件:AdmissionsUnitTest.java   
private void checkConstruction(
    Admissions      admissions,
    GeneralName     name,
    NamingAuthority auth)
    throws IOException
{
    checkValues(admissions, name, auth);

    admissions = Admissions.getInstance(admissions);

    checkValues(admissions, name, auth);

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

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

    admissions = Admissions.getInstance(info);

    checkValues(admissions, name, auth);
}
项目:bc-java    文件:ProfessionInfoUnitTest.java   
private void checkConstruction(
    ProfessionInfo profInfo,
    NamingAuthority auth,
    DirectoryString[] professionItems,
    DERObjectIdentifier[] 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.toASN1Object().getEncoded());

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

    profInfo = ProfessionInfo.getInstance(seq);

    checkValues(profInfo, auth, professionItems, professionOids, registrationNumber, addProfInfo);
}
项目:bc-java    文件:ProfessionInfoUnitTest.java   
private void checkValues(
    ProfessionInfo profInfo,
    NamingAuthority auth,
    DirectoryString[] professionItems,
    DERObjectIdentifier[] 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());
}
项目:gwt-crypto    文件:NamingAuthorityUnitTest.java   
private void checkValues(
    NamingAuthority auth,
    ASN1ObjectIdentifier namingAuthorityId,
    String              namingAuthorityURL,
    DirectoryString     namingAuthorityText)
{
    checkOptionalField("namingAuthorityId", namingAuthorityId, auth.getNamingAuthorityId());
    checkOptionalField("namingAuthorityURL", namingAuthorityURL, auth.getNamingAuthorityUrl());
    checkOptionalField("namingAuthorityText", namingAuthorityText, auth.getNamingAuthorityText());
}
项目:gwt-crypto    文件:AdmissionSyntaxUnitTest.java   
public void performTest()
    throws Exception
{
    GeneralName     name = new GeneralName(new X500Name("CN=hello world"));
    ASN1Sequence    admissions = new DERSequence(
                                    new Admissions(name,
                                      new NamingAuthority(new ASN1ObjectIdentifier("1.2.3"), "url", new DirectoryString("fred")),
                                      new ProfessionInfo[0]));
    AdmissionSyntax syntax = new AdmissionSyntax(name, admissions);

    checkConstruction(syntax, name, admissions);

    syntax = AdmissionSyntax.getInstance(null);

    if (syntax != null)
    {
        fail("null getInstance() failed.");
    }

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

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:gwt-crypto    文件:AdmissionsUnitTest.java   
public void performTest()
    throws Exception
{
    GeneralName name = new GeneralName(new X500Name("CN=hello world"));
    NamingAuthority auth =  new NamingAuthority(new ASN1ObjectIdentifier("1.2.3"), "url", new DirectoryString("fred"));
    Admissions  admissions = new Admissions(name, auth, new ProfessionInfo[0]);

    checkConstruction(admissions, name, auth);

    admissions = Admissions.getInstance(null);

    if (admissions != null)
    {
        fail("null getInstance() failed.");
    }

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

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:gwt-crypto    文件:AdmissionsUnitTest.java   
private void checkValues(
    Admissions      admissions,
    GeneralName     name,
    NamingAuthority auth)
{
    checkMandatoryField("admissionAuthority", name, admissions.getAdmissionAuthority());
    checkMandatoryField("namingAuthority", auth, admissions.getNamingAuthority());
}
项目:keystore-explorer    文件:X509Ext.java   
private String getNamingAuthorityStringValue(NamingAuthority namingAuthority, int indentLevel)
        throws IOException {
    // @formatter:off
    /*
         NamingAuthority ::= SEQUENCE
         {
           namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
           namingAuthorityUrl IA5String OPTIONAL,
           namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
         }
     */
    // @formatter:on

    StringBuilder sb = new StringBuilder();

    ASN1ObjectIdentifier namingAuthorityId = namingAuthority.getNamingAuthorityId();
    String namingAuthorityUrl = namingAuthority.getNamingAuthorityUrl();
    DirectoryString namingAuthorityText = namingAuthority.getNamingAuthorityText();

    if (namingAuthorityId != null) {
        sb.append(INDENT.toString(indentLevel));
        sb.append(MessageFormat.format(res.getString("Admission.NamingAuthorityOID"), namingAuthorityId.getId()));
        sb.append(NEWLINE);
    }

    if (namingAuthorityUrl != null) {
        sb.append(INDENT.toString(indentLevel));
        sb.append(MessageFormat.format(res.getString("Admission.NamingAuthorityURL"), namingAuthorityUrl));
        sb.append(NEWLINE);
    }

    if (namingAuthorityText != null) {
        sb.append(INDENT.toString(indentLevel));
        sb.append(MessageFormat.format(res.getString("Admission.NamingAuthorityText"),
                namingAuthorityText.toString()));
        sb.append(NEWLINE);
    }

    return sb.toString();
}
项目:xipki    文件:ProfessionInfoOption.java   
public ProfessionInfoOption(NamingAuthority namingAuthority, List<String> professionItems,
        List<ASN1ObjectIdentifier> professionOids,
        RegistrationNumberOption registrationNumberOption,
        byte[] addProfessionalInfo) {
    this.namingAuthority = namingAuthority;
    this.professionItems = ParamUtil.requireNonEmpty("professionItems", professionItems);
    this.professionOids = professionOids;
    this.registrationNumberOption = registrationNumberOption;
    this.addProfessionalInfo = addProfessionalInfo;
}
项目:xipki    文件:XmlX509CertprofileUtil.java   
private static NamingAuthority buildNamingAuthority(NamingAuthorityType jaxb) {
    ASN1ObjectIdentifier oid = (jaxb.getOid() == null) ? null
            : new ASN1ObjectIdentifier(jaxb.getOid().getValue());
    String url = StringUtil.isBlank(jaxb.getUrl()) ? null
            : jaxb.getUrl();
    DirectoryString text = StringUtil.isBlank(jaxb.getText()) ? null
            : new DirectoryString(jaxb.getText());
    return new NamingAuthority(oid, url, text);
}
项目:irma_future_id    文件:NamingAuthorityUnitTest.java   
private void checkValues(
    NamingAuthority auth,
    DERObjectIdentifier namingAuthorityId,
    String              namingAuthorityURL,
    DirectoryString     namingAuthorityText)
{
    checkOptionalField("namingAuthorityId", namingAuthorityId, auth.getNamingAuthorityId());
    checkOptionalField("namingAuthorityURL", namingAuthorityURL, auth.getNamingAuthorityUrl());
    checkOptionalField("namingAuthorityText", namingAuthorityText, auth.getNamingAuthorityText());
}
项目:irma_future_id    文件:AdmissionSyntaxUnitTest.java   
public void performTest()
    throws Exception
{
    GeneralName     name = new GeneralName(new X509Name("CN=hello world"));
    ASN1Sequence    admissions = new DERSequence(
                                    new Admissions(name,
                                      new NamingAuthority(new ASN1ObjectIdentifier("1.2.3"), "url", new DirectoryString("fred")),
                                      new ProfessionInfo[0]));
    AdmissionSyntax syntax = new AdmissionSyntax(name, admissions);

    checkConstruction(syntax, name, admissions);

    syntax = AdmissionSyntax.getInstance(null);

    if (syntax != null)
    {
        fail("null getInstance() failed.");
    }

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

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:irma_future_id    文件:AdmissionsUnitTest.java   
public void performTest()
    throws Exception
{
    GeneralName name = new GeneralName(new X509Name("CN=hello world"));
    NamingAuthority auth =  new NamingAuthority(new DERObjectIdentifier("1.2.3"), "url", new DirectoryString("fred"));
    Admissions  admissions = new Admissions(name, auth, new ProfessionInfo[0]);

    checkConstruction(admissions, name, auth);

    admissions = Admissions.getInstance(null);

    if (admissions != null)
    {
        fail("null getInstance() failed.");
    }

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

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:irma_future_id    文件:AdmissionsUnitTest.java   
private void checkValues(
    Admissions      admissions,
    GeneralName     name,
    NamingAuthority auth)
{
    checkMandatoryField("admissionAuthority", name, admissions.getAdmissionAuthority());
    checkMandatoryField("namingAuthority", auth, admissions.getNamingAuthority());
}
项目:bc-java    文件:NamingAuthorityUnitTest.java   
private void checkValues(
    NamingAuthority auth,
    DERObjectIdentifier namingAuthorityId,
    String              namingAuthorityURL,
    DirectoryString     namingAuthorityText)
{
    checkOptionalField("namingAuthorityId", namingAuthorityId, auth.getNamingAuthorityId());
    checkOptionalField("namingAuthorityURL", namingAuthorityURL, auth.getNamingAuthorityUrl());
    checkOptionalField("namingAuthorityText", namingAuthorityText, auth.getNamingAuthorityText());
}
项目:bc-java    文件:AdmissionSyntaxUnitTest.java   
public void performTest()
    throws Exception
{
    GeneralName     name = new GeneralName(new X509Name("CN=hello world"));
    ASN1Sequence    admissions = new DERSequence(
                                    new Admissions(name,
                                      new NamingAuthority(new ASN1ObjectIdentifier("1.2.3"), "url", new DirectoryString("fred")),
                                      new ProfessionInfo[0]));
    AdmissionSyntax syntax = new AdmissionSyntax(name, admissions);

    checkConstruction(syntax, name, admissions);

    syntax = AdmissionSyntax.getInstance(null);

    if (syntax != null)
    {
        fail("null getInstance() failed.");
    }

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

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:bc-java    文件:AdmissionsUnitTest.java   
public void performTest()
    throws Exception
{
    GeneralName name = new GeneralName(new X509Name("CN=hello world"));
    NamingAuthority auth =  new NamingAuthority(new DERObjectIdentifier("1.2.3"), "url", new DirectoryString("fred"));
    Admissions  admissions = new Admissions(name, auth, new ProfessionInfo[0]);

    checkConstruction(admissions, name, auth);

    admissions = Admissions.getInstance(null);

    if (admissions != null)
    {
        fail("null getInstance() failed.");
    }

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

        fail("getInstance() failed to detect bad object.");
    }
    catch (IllegalArgumentException e)
    {
        // expected
    }
}
项目:bc-java    文件:AdmissionsUnitTest.java   
private void checkValues(
    Admissions      admissions,
    GeneralName     name,
    NamingAuthority auth)
{
    checkMandatoryField("admissionAuthority", name, admissions.getAdmissionAuthority());
    checkMandatoryField("namingAuthority", auth, admissions.getNamingAuthority());
}
项目:xipki    文件:ProfessionInfoOption.java   
public NamingAuthority namingAuthority() {
    return namingAuthority;
}
项目:xipki    文件:AdmissionsOption.java   
public AdmissionsOption(GeneralName admissionAuthority, NamingAuthority namingAuthority,
        List<ProfessionInfoOption> professionInfos) {
    this.admissionAuthority = admissionAuthority;
    this.namingAuthority = namingAuthority;
    this.professionInfos = ParamUtil.requireNonEmpty("professionInfos", professionInfos);
}
项目:xipki    文件:AdmissionsOption.java   
public NamingAuthority namingAuthority() {
    return namingAuthority;
}