本文整理汇总了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());
}
示例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: 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;
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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
}
}
示例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
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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());
}