本文整理汇总了Java中org.bouncycastle.asn1.x500.DirectoryString.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java DirectoryString.getInstance方法的具体用法?Java DirectoryString.getInstance怎么用?Java DirectoryString.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.x500.DirectoryString
的用法示例。
在下文中一共展示了DirectoryString.getInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例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));
}
示例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));
}
示例4: getGivenName
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的package包/类
public DirectoryString[] getGivenName()
{
DirectoryString[] items = new DirectoryString[givenName.size()];
int count = 0;
for (Enumeration e = givenName.getObjects(); e.hasMoreElements();)
{
items[count++] = DirectoryString.getInstance(e.nextElement());
}
return items;
}
示例5: PersonalData
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的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());
}
}
}
示例6: ProcurationSyntax
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的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());
}
}
}
示例7: getProfessionItems
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的package包/类
/**
* @return Returns the professionItems.
*/
public DirectoryString[] getProfessionItems()
{
DirectoryString[] items = new DirectoryString[professionItems.size()];
int count = 0;
for (Enumeration e = professionItems.getObjects(); e.hasMoreElements();)
{
items[count++] = DirectoryString.getInstance(e.nextElement());
}
return items;
}
示例8: getInstance
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的package包/类
public static AdditionalInformationSyntax getInstance(Object obj)
{
if (obj instanceof AdditionalInformationSyntax)
{
return (AdditionalInformationSyntax)obj;
}
if (obj != null)
{
return new AdditionalInformationSyntax(DirectoryString.getInstance(obj));
}
return null;
}
示例9: getInstance
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的package包/类
public static Restriction getInstance(Object obj)
{
if (obj instanceof Restriction)
{
return (Restriction)obj;
}
if (obj != null)
{
return new Restriction(DirectoryString.getInstance(obj));
}
return null;
}
示例10: SignerLocation
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的package包/类
private SignerLocation(
ASN1Sequence seq)
{
Enumeration e = seq.getObjects();
while (e.hasMoreElements())
{
DERTaggedObject o = (DERTaggedObject)e.nextElement();
switch (o.getTagNo())
{
case 0:
DirectoryString countryNameDirectoryString = DirectoryString.getInstance(o, true);
this.countryName = new DERUTF8String(countryNameDirectoryString.getString());
break;
case 1:
DirectoryString localityNameDirectoryString = DirectoryString.getInstance(o, true);
this.localityName = new DERUTF8String(localityNameDirectoryString.getString());
break;
case 2:
if (o.isExplicit())
{
this.postalAddress = ASN1Sequence.getInstance(o, true);
}
else // handle erroneous implicitly tagged sequences
{
this.postalAddress = ASN1Sequence.getInstance(o, false);
}
if (postalAddress != null && postalAddress.size() > 6)
{
throw new IllegalArgumentException("postal address must contain less than 6 strings");
}
break;
default:
throw new IllegalArgumentException("illegal tag");
}
}
}
示例11: PersonalData
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的package包/类
/**
* Constructor from ASN1Sequence.
* <p>
* The sequence is of type NameOrPseudonym:
* <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>
* </p>
* @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());
}
}
}
示例12: ProcurationSyntax
import org.bouncycastle.asn1.x500.DirectoryString; //导入方法依赖的package包/类
/**
* Constructor from ASN1Sequence.
* <p>
* The sequence is of type ProcurationSyntax:
* <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>
* </p>
* @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());
}
}
}