org.bouncycastle.asn1.ASN1Sequence.getInstance()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(60)

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

ASN1Sequence.getInstance介绍

[英]Return an ASN1 sequence from a tagged object. There is a special case here, if an object appears to have been explicitly tagged on reading but we were expecting it to be implicitly tagged in the normal course of events it indicates that we lost the surrounding sequence - so we need to add it back (this will happen if the tagged object is a sequence that contains other sequences). If you are dealing with implicitly tagged sequences you really should be using this method.
[中]从标记对象返回ASN1序列。这里有一种特殊情况,如果一个对象在读取时被显式标记,但我们希望它在正常事件过程中被隐式标记,这表明我们丢失了周围的序列-因此我们需要将其添加回(如果标记的对象是包含其他序列的序列,则会发生这种情况)。如果您正在处理隐式标记的序列,那么您确实应该使用此方法。

代码示例

代码示例来源:origin: cloudfoundry/uaa

KeyFactory fact = KeyFactory.getInstance("RSA");
if (type.equals("RSA PRIVATE KEY")) {
  ASN1Sequence seq = ASN1Sequence.getInstance(content);
  if (seq.size() != 9) {
    throw new IllegalArgumentException("Invalid RSA Private Key ASN1 sequence.");
  publicKey = fact.generatePublic(keySpec);
} else if (type.equals("RSA PUBLIC KEY")) {
  ASN1Sequence seq = ASN1Sequence.getInstance(content);
  org.bouncycastle.asn1.pkcs.RSAPublicKey key = org.bouncycastle.asn1.pkcs.RSAPublicKey.getInstance(seq);
  RSAPublicKeySpec pubSpec = new RSAPublicKeySpec(key.getModulus(), key.getPublicExponent());

代码示例来源:origin: cloudfoundry/uaa

KeyFactory fact = KeyFactory.getInstance("RSA");
if (type.equals("RSA PRIVATE KEY")) {
  ASN1Sequence seq = ASN1Sequence.getInstance(content);
  if (seq.size() != 9) {
    throw new IllegalArgumentException("Invalid RSA Private Key ASN1 sequence.");
  publicKey = fact.generatePublic(keySpec);
} else if (type.equals("RSA PUBLIC KEY")) {
  ASN1Sequence seq = ASN1Sequence.getInstance(content);
  org.bouncycastle.asn1.pkcs.RSAPublicKey key = org.bouncycastle.asn1.pkcs.RSAPublicKey.getInstance(seq);
  RSAPublicKeySpec pubSpec = new RSAPublicKeySpec(key.getModulus(), key.getPublicExponent());

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

public static LDSVersionInfo getInstance(Object obj)
{
  if (obj instanceof LDSVersionInfo)
  {
    return (LDSVersionInfo)obj;
  }
  else if (obj != null)
  {
    return new LDSVersionInfo(ASN1Sequence.getInstance(obj));
  }
  return null;
}

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

public static CertRequest getInstance(Object o)
{
  if (o instanceof CertRequest)
  {
    return (CertRequest)o;
  }
  else if (o != null)
  {
    return new CertRequest(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

public static CRLBag getInstance(Object o)
{
  if (o instanceof CRLBag)
  {
    return (CRLBag)o;
  }
  else if (o != null)
  {
    return new CRLBag(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

public static PathProcInput getInstance(
  ASN1TaggedObject obj,
  boolean explicit)
{
  return getInstance(ASN1Sequence.getInstance(obj, explicit));
}

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

public static XMSSPublicKey getInstance(Object o)
{
  if (o instanceof XMSSPublicKey)
  {
    return (XMSSPublicKey)o;
  }
  else if (o != null)
  {
    return new XMSSPublicKey(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

public static SingleResponse getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  return getInstance(ASN1Sequence.getInstance(obj, explicit));
}

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

public static ObjectStore getInstance(Object o)
{
  if (o instanceof ObjectStore)
  {
    return (ObjectStore)o;
  }
  else if (o != null)
  {
    return new ObjectStore(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

public static DVCSRequest getInstance(Object obj)
{
  if (obj instanceof DVCSRequest)
  {
    return (DVCSRequest)obj;
  }
  else if (obj != null)
  {
    return new DVCSRequest(ASN1Sequence.getInstance(obj));
  }
  return null;
}

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

public static PollReqContent getInstance(Object o)
{
  if (o instanceof PollReqContent)
  {
    return (PollReqContent)o;
  }
  if (o != null)
  {
    return new PollReqContent(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

public static CMCUnsignedData getInstance(Object o)
{
  if (o instanceof CMCUnsignedData)
  {
    return (CMCUnsignedData)o;
  }
  if (o != null)
  {
    return new CMCUnsignedData(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

public static CertificationRequest getInstance(Object o)
{
  if (o instanceof CertificationRequest)
  {
    return (CertificationRequest)o;
  }
  if (o != null)
  {
    return new CertificationRequest(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

public static GOST28147Parameters getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  return getInstance(ASN1Sequence.getInstance(obj, explicit));
}

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

public static EncryptedValue getInstance(Object o)
{
  if (o instanceof EncryptedValue)
  {
    return (EncryptedValue)o;
  }
  else if (o != null)
  {
    return new EncryptedValue(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

public static XMSSPrivateKey getInstance(Object o)
{
  if (o instanceof XMSSPrivateKey)
  {
    return (XMSSPrivateKey)o;
  }
  else if (o != null)
  {
    return new XMSSPrivateKey(ASN1Sequence.getInstance(o));
  }
  return null;
}

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

private static ASN1Sequence getReq(
  byte[]  r)
  throws IOException
{
  ASN1InputStream aIn = new ASN1InputStream(new ByteArrayInputStream(r));
  return ASN1Sequence.getInstance(aIn.readObject());
}

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

public static CRLDistributionPoints getInstance(Object obj) {
  if (obj instanceof CRLDistributionPoints) {
    return (CRLDistributionPoints) obj;
  } else if (obj instanceof ASN1Sequence) {
    return new CRLDistributionPoints((ASN1Sequence) obj);
  } else if (obj instanceof byte[]) {
    return new CRLDistributionPoints(ASN1Sequence.getInstance(obj));
  }
  throw new IllegalArgumentException("unknown object type");
}

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

public static SubjectInfoAccess getInstance(Object obj) {
  if (obj instanceof SubjectInfoAccess) {
    return (SubjectInfoAccess) obj;
  } else if (obj instanceof ASN1Sequence) {
    return new SubjectInfoAccess((ASN1Sequence) obj);
  } else if (obj instanceof byte[]) {
    return new SubjectInfoAccess(ASN1Sequence.getInstance(obj));
  }
  throw new IllegalArgumentException("unknown object");
}

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

private EncryptedData(
  ASN1Sequence seq)
{
  int version = ((ASN1Integer)seq.getObjectAt(0)).getValue().intValue();
  if (version != 0)
  {
    throw new IllegalArgumentException("sequence not version 0");
  }
  this.data = ASN1Sequence.getInstance(seq.getObjectAt(1));
}

相关文章