org.bouncycastle.asn1.DERPrintableString类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.bouncycastle.asn1.DERPrintableString类的一些代码示例,展示了DERPrintableString类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DERPrintableString类的具体详情如下:
包路径:org.bouncycastle.asn1.DERPrintableString
类名称:DERPrintableString

DERPrintableString介绍

[英]DER PrintableString object.
[中]DER PrintableString对象。

代码示例

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public String getLdsVersion()
{
  return ldsVersion.getString();
}

代码示例来源:origin: redfish64/TinyTravelTracker

public LDSVersionInfo(String ldsVersion, String unicodeVersion)
{
  this.ldsVersion = new DERPrintableString(ldsVersion);
  this.unicodeVersion = new DERPrintableString(unicodeVersion);
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

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));
}

代码示例来源:origin: redfish64/TinyTravelTracker

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");
}

代码示例来源:origin: org.xipki/certprofile-xml

placeOfBirth = DirectoryString.getInstance(attrVal).getString();
} else if (ObjectIdentifiers.DN_GENDER.equals(attrType)) {
 gender = DERPrintableString.getInstance(attrVal).getString();
} else if (ObjectIdentifiers.DN_COUNTRY_OF_CITIZENSHIP.equals(attrType)) {
 String country = DERPrintableString.getInstance(attrVal).getString();
 countryOfCitizenshipList.add(country);
} else if (ObjectIdentifiers.DN_COUNTRY_OF_RESIDENCE.equals(attrType)) {
 String country = DERPrintableString.getInstance(attrVal).getString();
 countryOfResidenceList.add(country);
} else {
   throw new BadCertTemplateException("invalid gender " + gender);
  ASN1Encodable attrVal = new DERPrintableString(gender);
  attrs.add(new Attribute(attrType, new DERSet(attrVal)));
  continue;
    throw new BadCertTemplateException("invalid countryOfCitizenship code " + country);
   ASN1Encodable attrVal = new DERPrintableString(country);
   attrs.add(new Attribute(attrType, new DERSet(attrVal)));
    throw new BadCertTemplateException("invalid countryOfResidence code " + country);
   ASN1Encodable attrVal = new DERPrintableString(country);
   attrs.add(new Attribute(attrType, new DERSet(attrVal)));

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * return a Printable String from a tagged object.
 *
 * @param obj the tagged object holding the object we want
 * @param explicit true if the object is meant to be explicitly
 *              tagged false otherwise.
 * @exception IllegalArgumentException if the tagged object cannot
 *               be converted.
 * @return a DERPrintableString instance, or null.
 */
public static DERPrintableString getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  ASN1Primitive o = obj.getObject();
  if (explicit || o instanceof DERPrintableString)
  {
    return getInstance(o);
  }
  else
  {
    return new DERPrintableString(ASN1OctetString.getInstance(o).getOctets());
  }
}

代码示例来源:origin: kaikramer/keystore-explorer

DERPrintableString country = DERPrintableString.getInstance(fullAgeAtCountry.getObjectAt(1));
sb.append(MessageFormat.format(res.getString("DeclarationOfMajority.fullAgeAtCountry"), country.toString(),
    fullAge.toString()));
sb.append(NEWLINE);

代码示例来源:origin: jscep/jscep

private TransactionId toTransactionId(final Attribute attr) {
  final DERPrintableString string = (DERPrintableString) attr
      .getAttrValues().getObjectAt(0);
  return new TransactionId(string.getOctets());
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

/**
 * Return a printable string from the passed in object.
 *
 * @param obj a DERPrintableString or an object that can be converted into one.
 * @exception IllegalArgumentException if the object cannot be converted.
 * @return a DERPrintableString instance, or null.
 */
public static DERPrintableString getInstance(
  Object  obj)
{
  if (obj == null || obj instanceof DERPrintableString)
  {
    return (DERPrintableString)obj;
  }
  if (obj instanceof byte[])
  {
    try
    {
      return (DERPrintableString)fromByteArray((byte[])obj);
    }
    catch (Exception e)
    {
      throw new IllegalArgumentException("encoding error in getInstance: " + e.toString());
    }
  }
  throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

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");
}

代码示例来源:origin: org.xipki.pki/ca-certprofile-xml

placeOfBirth = DirectoryString.getInstance(attrVal).getString();
} else if (ObjectIdentifiers.DN_GENDER.equals(attrType)) {
  gender = DERPrintableString.getInstance(attrVal).getString();
} else if (ObjectIdentifiers.DN_COUNTRY_OF_CITIZENSHIP.equals(attrType)) {
  String country = DERPrintableString.getInstance(attrVal).getString();
  countryOfCitizenshipList.add(country);
} else if (ObjectIdentifiers.DN_COUNTRY_OF_RESIDENCE.equals(attrType)) {
  String country = DERPrintableString.getInstance(attrVal).getString();
  countryOfResidenceList.add(country);
} else {
      throw new BadCertTemplateException("invalid gender " + gender);
    ASN1Encodable attrVal = new DERPrintableString(gender);
    attrs.add(new Attribute(attrType, new DERSet(attrVal)));
    continue;
            "invalid countryOfCitizenship code " + country);
      ASN1Encodable attrVal = new DERPrintableString(country);
      attrs.add(new Attribute(attrType, new DERSet(attrVal)));
            "invalid countryOfResidence code " + country);
      ASN1Encodable attrVal = new DERPrintableString(country);
      attrs.add(new Attribute(attrType, new DERSet(attrVal)));

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

/**
 * Return a Printable String from a tagged object.
 *
 * @param obj the tagged object holding the object we want
 * @param explicit true if the object is meant to be explicitly
 *              tagged false otherwise.
 * @exception IllegalArgumentException if the tagged object cannot
 *               be converted.
 * @return a DERPrintableString instance, or null.
 */
public static DERPrintableString getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  ASN1Primitive o = obj.getObject();
  if (explicit || o instanceof DERPrintableString)
  {
    return getInstance(o);
  }
  else
  {
    return new DERPrintableString(ASN1OctetString.getInstance(o).getOctets());
  }
}

代码示例来源:origin: com.google.code.jscep/jscep-api

/**
 * Returns the recipient {@link TransactionId} associated with this <code>pkiMessage</code>.
 * 
 * @return the sender {@link TransactionId}.
 */
public TransactionId getTransactionId() {
  final Attribute attr = getAttributeTable().get(SCEPObjectIdentifiers.transId);
  DERPrintableString transId = (DERPrintableString) attr.getAttrValues().getObjectAt(0);
  
  return new TransactionId(transId.getOctets());
}

代码示例来源:origin: redfish64/TinyTravelTracker

/**
 * return a printable string from the passed in object.
 *
 * @param obj a DERPrintableString or an object that can be converted into one.
 * @exception IllegalArgumentException if the object cannot be converted.
 * @return a DERPrintableString instance, or null.
 */
public static DERPrintableString getInstance(
  Object  obj)
{
  if (obj == null || obj instanceof DERPrintableString)
  {
    return (DERPrintableString)obj;
  }
  if (obj instanceof byte[])
  {
    try
    {
      return (DERPrintableString)fromByteArray((byte[])obj);
    }
    catch (Exception e)
    {
      throw new IllegalArgumentException("encoding error in getInstance: " + e.toString());
    }
  }
  throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public LDSVersionInfo(String ldsVersion, String unicodeVersion)
{
  this.ldsVersion = new DERPrintableString(ldsVersion);
  this.unicodeVersion = new DERPrintableString(unicodeVersion);
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

registrationNumber = DERPrintableString.getInstance(o).getString();
if (o instanceof DERPrintableString)
  registrationNumber = DERPrintableString.getInstance(o).getString();

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public String getUnicodeVersion()
{
  return unicodeVersion.getString();
}

代码示例来源:origin: redfish64/TinyTravelTracker

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));
}

代码示例来源:origin: br.com.swconsultoria/java_certificado

} else if (derObject instanceof DERPrintableString) {
  DERPrintableString octet = (DERPrintableString) derObject;
  valueOfTag = new String(octet.getOctets());
} else if (derObject instanceof DERUTF8String) {
  DERUTF8String str = (DERUTF8String) derObject;

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

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);
}

相关文章