• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DERPrintableString类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getInstance

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

    if (obj instanceof ASN1Integer)
    {
        ASN1Integer numericobj = ASN1Integer.getInstance(obj);
        int numeric = numericobj.getValue().intValue();  
        return new Iso4217CurrencyCode(numeric);            
    }
    else
    if (obj instanceof DERPrintableString)
    {
        DERPrintableString alphabetic = DERPrintableString.getInstance(obj);
        return new Iso4217CurrencyCode(alphabetic.getString());
    }
    throw new IllegalArgumentException("unknown object in getInstance");
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:Iso4217CurrencyCode.java


示例2: toASN1Primitive

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <p/>
 * Returns:
 * <p/>
 * <pre>
 *               ProcurationSyntax ::= SEQUENCE {
 *                 country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
 *                 typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
 *                 signingFor [3] EXPLICIT SigningFor
 *               }
 * <p/>
 *               SigningFor ::= CHOICE
 *               {
 *                 thirdPerson GeneralName,
 *                 certRef IssuerSerial
 *               }
 * </pre>
 *
 * @return a DERObject
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector vec = new ASN1EncodableVector();
    if (country != null)
    {
        vec.add(new DERTaggedObject(true, 1, new DERPrintableString(country, true)));
    }
    if (typeOfSubstitution != null)
    {
        vec.add(new DERTaggedObject(true, 2, typeOfSubstitution));
    }
    if (thirdPerson != null)
    {
        vec.add(new DERTaggedObject(true, 3, thirdPerson));
    }
    else
    {
        vec.add(new DERTaggedObject(true, 3, certRef));
    }

    return new DERSequence(vec);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:44,代码来源:ProcurationSyntax.java


示例3: toASN1Primitive

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <p/>
 * Returns:
 * <p/>
 * <pre>
 *               ProfessionInfo ::= SEQUENCE
 *               {
 *                 namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
 *                 professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
 *                 professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
 *                 registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
 *                 addProfessionInfo OCTET STRING OPTIONAL
 *               }
 * </pre>
 *
 * @return a DERObject
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector vec = new ASN1EncodableVector();
    if (namingAuthority != null)
    {
        vec.add(new DERTaggedObject(true, 0, namingAuthority));
    }
    vec.add(professionItems);
    if (professionOIDs != null)
    {
        vec.add(professionOIDs);
    }
    if (registrationNumber != null)
    {
        vec.add(new DERPrintableString(registrationNumber, true));
    }
    if (addProfessionInfo != null)
    {
        vec.add(addProfessionInfo);
    }
    return new DERSequence(vec);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:41,代码来源:ProfessionInfo.java


示例4: toASN1Primitive

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <p>
 * Returns:
 * <pre>
 *               ProcurationSyntax ::= SEQUENCE {
 *                 country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
 *                 typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
 *                 signingFor [3] EXPLICIT SigningFor
 *               }
 *
 *               SigningFor ::= CHOICE
 *               {
 *                 thirdPerson GeneralName,
 *                 certRef IssuerSerial
 *               }
 * </pre>
 *
 * @return a DERObject
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector vec = new ASN1EncodableVector();
    if (country != null)
    {
        vec.add(new DERTaggedObject(true, 1, new DERPrintableString(country, true)));
    }
    if (typeOfSubstitution != null)
    {
        vec.add(new DERTaggedObject(true, 2, typeOfSubstitution));
    }
    if (thirdPerson != null)
    {
        vec.add(new DERTaggedObject(true, 3, thirdPerson));
    }
    else
    {
        vec.add(new DERTaggedObject(true, 3, certRef));
    }

    return new DERSequence(vec);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:43,代码来源:ProcurationSyntax.java


示例5: DeclarationOfMajority

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
public DeclarationOfMajority(boolean fullAge, String country)
{
    if (country.length() > 2)
    {
        throw new IllegalArgumentException("country can only be 2 characters");
    }

    if (fullAge)
    {
        declaration = new DERTaggedObject(false, 1, new DERSequence(new DERPrintableString(country, true)));
    }
    else
    {
        ASN1EncodableVector v = new ASN1EncodableVector();

        v.add(ASN1Boolean.FALSE);
        v.add(new DERPrintableString(country, true));

        declaration = new DERTaggedObject(false, 1, new DERSequence(v));
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:22,代码来源:DeclarationOfMajority.java


示例6: toASN1Primitive

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <p>
 * Returns:
 * <pre>
 *               ProfessionInfo ::= SEQUENCE
 *               {
 *                 namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
 *                 professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
 *                 professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
 *                 registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
 *                 addProfessionInfo OCTET STRING OPTIONAL
 *               }
 * </pre>
 *
 * @return a DERObject
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector vec = new ASN1EncodableVector();
    if (namingAuthority != null)
    {
        vec.add(new DERTaggedObject(true, 0, namingAuthority));
    }
    vec.add(professionItems);
    if (professionOIDs != null)
    {
        vec.add(professionOIDs);
    }
    if (registrationNumber != null)
    {
        vec.add(new DERPrintableString(registrationNumber, true));
    }
    if (addProfessionInfo != null)
    {
        vec.add(addProfessionInfo);
    }
    return new DERSequence(vec);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:40,代码来源:ProfessionInfo.java


示例7: encodeStringValue

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
protected ASN1Encodable encodeStringValue(ASN1ObjectIdentifier oid,
		String value) {
	if (oid.equals(EmailAddress) || oid.equals(DC))
    {
        return new DERIA5String(value);
    }
    else if (oid.equals(DATE_OF_BIRTH))  // accept time string as well as # (for compatibility)
    {
        return new ASN1GeneralizedTime(value);
    }
    else if (oid.equals(C) || oid.equals(SN) || oid.equals(DN_QUALIFIER)
        || oid.equals(TELEPHONE_NUMBER))
    {
        return new DERPrintableString(value);
    }
	
	return super.encodeStringValue(oid, value);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:19,代码来源:BCStyle.java


示例8: populateTextField

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
private static void populateTextField(Attribute[] attrs, JTextField textField, ASN1ObjectIdentifier pkcs9Attr) {
	if (attrs != null) {
		for (Attribute attribute : attrs) {

			ASN1ObjectIdentifier attributeOid = attribute.getAttrType();

			if (attributeOid.equals(pkcs9Attr)) {
				ASN1Encodable challenge = attribute.getAttributeValues()[0];

				// data type can be one of IA5String or UTF8String
				if (challenge instanceof DERPrintableString) {
					textField.setText(((DERPrintableString) challenge).getString());
				} else if (challenge instanceof DERUTF8String) {
					textField.setText(((DERUTF8String) challenge).getString());
				}
				textField.setCaretPosition(0);
			}
		}
	}
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:21,代码来源:DialogHelper.java


示例9: encodeStringValue

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
@Override
protected ASN1Encodable encodeStringValue(ASN1ObjectIdentifier oid,
		String value) {
	if (oid.equals(dc) || oid.equals(emailAddress))
    {
        return new DERIA5String(value);
    }
    else if (oid.equals(c) || oid.equals(serialNumber) || oid.equals(dnQualifier)
        || oid.equals(telephoneNumber) || oid.equals(gender)
        || oid.equals(countryOfCitizenship) || oid.equals(countryOfResidence))
    {
        return new DERPrintableString(value);
    }

	return super.encodeStringValue(oid, value);
}
 
开发者ID:BandwidthOnDemand,项目名称:nsi-dds,代码行数:17,代码来源:ExtendedRFC4519Style.java


示例10: matchStringType

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
private static boolean matchStringType(ASN1Encodable atvValue, StringType stringType) {
    boolean correctStringType = true;
    switch (stringType) {
    case bmpString:
        correctStringType = (atvValue instanceof DERBMPString);
        break;
    case printableString:
        correctStringType = (atvValue instanceof DERPrintableString);
        break;
    case teletexString:
        correctStringType = (atvValue instanceof DERT61String);
        break;
    case utf8String:
        correctStringType = (atvValue instanceof DERUTF8String);
        break;
    case ia5String:
        correctStringType = (atvValue instanceof DERIA5String);
        break;
    default:
        throw new RuntimeException("should not reach here, unknown StringType " + stringType);
    } // end switch
    return correctStringType;
}
 
开发者ID:xipki,项目名称:xipki,代码行数:24,代码来源:SubjectChecker.java


示例11: LDSVersionInfo

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
private LDSVersionInfo(ASN1Sequence seq)
{
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException("sequence wrong size for LDSVersionInfo");
    }

    this.ldsVersion = DERPrintableString.getInstance(seq.getObjectAt(0));
    this.unicodeVersion = DERPrintableString.getInstance(seq.getObjectAt(1));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:11,代码来源:LDSVersionInfo.java


示例12: PersonalData

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
/**
 * Constructor from ASN1Sequence.
 * <p/>
 * The sequence is of type NameOrPseudonym:
 * <p/>
 * <pre>
 *     PersonalData ::= SEQUENCE {
 *       nameOrPseudonym NameOrPseudonym,
 *       nameDistinguisher [0] INTEGER OPTIONAL,
 *       dateOfBirth [1] GeneralizedTime OPTIONAL,
 *       placeOfBirth [2] DirectoryString OPTIONAL,
 *       gender [3] PrintableString OPTIONAL,
 *       postalAddress [4] DirectoryString OPTIONAL
 *       }
 * </pre>
 *
 * @param seq The ASN.1 sequence.
 */
private PersonalData(ASN1Sequence seq)
{
    if (seq.size() < 1)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }

    Enumeration e = seq.getObjects();

    nameOrPseudonym = NameOrPseudonym.getInstance(e.nextElement());

    while (e.hasMoreElements())
    {
        ASN1TaggedObject o = ASN1TaggedObject.getInstance(e.nextElement());
        int tag = o.getTagNo();
        switch (tag)
        {
            case 0:
                nameDistinguisher = ASN1Integer.getInstance(o, false).getValue();
                break;
            case 1:
                dateOfBirth = ASN1GeneralizedTime.getInstance(o, false);
                break;
            case 2:
                placeOfBirth = DirectoryString.getInstance(o, true);
                break;
            case 3:
                gender = DERPrintableString.getInstance(o, false).getString();
                break;
            case 4:
                postalAddress = DirectoryString.getInstance(o, true);
                break;
            default:
                throw new IllegalArgumentException("Bad tag number: " + o.getTagNo());
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:57,代码来源:PersonalData.java


示例13: toASN1Primitive

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
/**
 * Produce an object suitable for an ASN1OutputStream.
 * <p/>
 * Returns:
 * <p/>
 * <pre>
 *     PersonalData ::= SEQUENCE {
 *       nameOrPseudonym NameOrPseudonym,
 *       nameDistinguisher [0] INTEGER OPTIONAL,
 *       dateOfBirth [1] GeneralizedTime OPTIONAL,
 *       placeOfBirth [2] DirectoryString OPTIONAL,
 *       gender [3] PrintableString OPTIONAL,
 *       postalAddress [4] DirectoryString OPTIONAL
 *       }
 * </pre>
 *
 * @return a DERObject
 */
public ASN1Primitive toASN1Primitive()
{
    ASN1EncodableVector vec = new ASN1EncodableVector();
    vec.add(nameOrPseudonym);
    if (nameDistinguisher != null)
    {
        vec.add(new DERTaggedObject(false, 0, new ASN1Integer(nameDistinguisher)));
    }
    if (dateOfBirth != null)
    {
        vec.add(new DERTaggedObject(false, 1, dateOfBirth));
    }
    if (placeOfBirth != null)
    {
        vec.add(new DERTaggedObject(true, 2, placeOfBirth));
    }
    if (gender != null)
    {
        vec.add(new DERTaggedObject(false, 3, new DERPrintableString(gender, true)));
    }
    if (postalAddress != null)
    {
        vec.add(new DERTaggedObject(true, 4, postalAddress));
    }
    return new DERSequence(vec);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:45,代码来源:PersonalData.java


示例14: getConvertedValue

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
/**
 * Apply default coversion for the given value depending on the oid
 * and the character range of the value.
 * 
 * @param oid the object identifier for the DN entry
 * @param value the value associated with it
 * @return the ASN.1 equivalent for the string value.
 */
public ASN1Primitive getConvertedValue(
    ASN1ObjectIdentifier  oid,
    String               value)
{
    if (value.length() != 0 && value.charAt(0) == '#')
    {
        try
        {
            return convertHexEncoded(value, 1);
        }
        catch (IOException e)
        {
            throw new RuntimeException("can't recode value for oid " + oid.getId());
        }
    }
    else
    {
        if (value.length() != 0 && value.charAt(0) == '\\')
        {
            value = value.substring(1);
        }
        if (oid.equals(X509Name.EmailAddress) || oid.equals(X509Name.DC))
        {
            return new DERIA5String(value);
        }
        else if (oid.equals(X509Name.DATE_OF_BIRTH))  // accept time string as well as # (for compatibility)
        {
            return new DERGeneralizedTime(value);
        }
        else if (oid.equals(X509Name.C) || oid.equals(X509Name.SN) || oid.equals(X509Name.DN_QUALIFIER)
            || oid.equals(X509Name.TELEPHONE_NUMBER))
        {
             return new DERPrintableString(value);
        }
    }
    
    return new DERUTF8String(value);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:47,代码来源:X509DefaultEntryConverter.java


示例15: Iso4217CurrencyCode

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
public Iso4217CurrencyCode(
    String alphabetic)
{
    if (alphabetic.length() > ALPHABETIC_MAXSIZE)
    {
        throw new IllegalArgumentException("wrong size in alphabetic code : max size is " + ALPHABETIC_MAXSIZE);
    }
    obj = new DERPrintableString(alphabetic);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:10,代码来源:Iso4217CurrencyCode.java


示例16: ProcurationSyntax

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
/**
 * Constructor from ASN1Sequence.
 * <p/>
 * The sequence is of type ProcurationSyntax:
 * <p/>
 * <pre>
 *               ProcurationSyntax ::= SEQUENCE {
 *                 country [1] EXPLICIT PrintableString(SIZE(2)) OPTIONAL,
 *                 typeOfSubstitution [2] EXPLICIT DirectoryString (SIZE(1..128)) OPTIONAL,
 *                 signingFor [3] EXPLICIT SigningFor
 *               }
 * <p/>
 *               SigningFor ::= CHOICE
 *               {
 *                 thirdPerson GeneralName,
 *                 certRef IssuerSerial
 *               }
 * </pre>
 *
 * @param seq The ASN.1 sequence.
 */
private ProcurationSyntax(ASN1Sequence seq)
{
    if (seq.size() < 1 || seq.size() > 3)
    {
        throw new IllegalArgumentException("Bad sequence size: " + seq.size());
    }
    Enumeration e = seq.getObjects();

    while (e.hasMoreElements())
    {
        ASN1TaggedObject o = ASN1TaggedObject.getInstance(e.nextElement());
        switch (o.getTagNo())
        {
            case 1:
                country = DERPrintableString.getInstance(o, true).getString();
                break;
            case 2:
                typeOfSubstitution = DirectoryString.getInstance(o, true);
                break;
            case 3:
                ASN1Encodable signingFor = o.getObject();
                if (signingFor instanceof ASN1TaggedObject)
                {
                    thirdPerson = GeneralName.getInstance(signingFor);
                }
                else
                {
                    certRef = IssuerSerial.getInstance(signingFor);
                }
                break;
            default:
                throw new IllegalArgumentException("Bad tag number: " + o.getTagNo());
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:57,代码来源:ProcurationSyntax.java


示例17: MonetaryLimit

import org.bouncycastle.asn1.DERPrintableString; //导入依赖的package包/类
private MonetaryLimit(ASN1Sequence seq)
{
    if (seq.size() != 3)
    {
        throw new IllegalArgumentException("Bad sequence size: "
            + seq.size());
    }
    Enumeration e = seq.getObjects();
    currency = DERPrintableString.getInstance(e.nextElement());
    amount = ASN1Integer.getInstance(e.nextElement());
    exponent = ASN1Integer.getInstance(e.nextElement());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:MonetaryLimit.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DataFetcher类代码示例发布时间:2022-05-21
下一篇:
Java AsyncMessageHeader类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap