org.spongycastle.asn1.ASN1Sequence类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(139)

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

ASN1Sequence介绍

[英]ASN.1 SEQUENCE and SEQUENCE OF constructs.

DER form is always definite form length fields, while BER support uses indefinite form.

X.690

8: Basic encoding rules

8.9 Encoding of a sequence value
8.9.1 The encoding of a sequence value shall be constructed.

8.9.2 The contents octets shall consist of the complete encoding of one data value from each of the types listed in the ASN.1 definition of the sequence type, in the order of their appearance in the definition, unless the type was referenced with the keyword OPTIONAL or the keyword DEFAULT.

8.9.3 The encoding of a data value may, but need not, be present for a type which was referenced with the keyword OPTIONAL or the keyword DEFAULT. If present, it shall appear in the encoding at the point corresponding to the appearance of the type in the ASN.1 definition.

8.10 Encoding of a sequence-of value

8.10.1 The encoding of a sequence-of value shall be constructed.

8.10.2 The contents octets shall consist of zero, one or more complete encodings of data values from the type listed in the ASN.1 definition.

8.10.3 The order of the encodings of the data values shall be the same as the order of the data values in the sequence-of value to be encoded.

9: Canonical encoding rules

9.1 Length forms
If the encoding is constructed, it shall employ the indefinite-length form. If the encoding is primitive, it shall include the fewest length octets necessary. [Contrast with 8.1.3.2 b).]

11: Restrictions on BER employed by both CER and DER

11.5 Set and sequence components with default value

The encoding of a set value or sequence value shall not include an encoding for any component value which is equal to its default value.
[中]ASN。1SEQUENCESEQUENCE OF构造。
DER form始终是确定格式长度字段,而BER支持使用不确定格式。
X.690
8:基本编码规则
8.9序列值的编码
8.9.1应构造序列值的编码。
8.9.2内容八位字节应包括ASN中列出的每种类型的一个数据值的完整编码。1序列类型的定义,按照其在定义中的出现顺序,除非使用关键字OPTIONAL或关键字DEFAULT引用该类型。
8.9.3对于使用关键字OPTIONAL或关键字DEFAULT引用的类型,数据值的编码可能存在,但无需存在。如果存在,则其应出现在编码中与ASN中类型外观相对应的点处。1定义。
8.10值序列的编码
8.10.1应构造值序列的编码。
8.10.2内容八位字节应由ASN中所列类型的零、一个或多个完整数据值编码组成。1定义。
8.10.3数据值的编码顺序应与待编码值序列中的数据值顺序相同。
9:规范编码规则
9.1长度表格
如果构造了编码,则应采用不定长形式。如果编码为原始编码,则应包含所需的最小长度的八位字节。[与8.1.3.2 b相比。]
11:CER和DER对BER的限制
11.5使用默认值设置和排序组件
设定值或序列值的编码不应包括等于其默认值的任何组件值的编码。

代码示例

代码示例来源:origin: com.madgag.spongycastle/core

public IDEACBCPar(
  ASN1Sequence  seq)
{
  if (seq.size() == 1)
  {
    iv = (ASN1OctetString)seq.getObjectAt(0);
  }
  else
  {
    iv = null;
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

public ProfessionInfo[] getProfessionInfos()
{
  ProfessionInfo[] infos = new ProfessionInfo[professionInfos.size()];
  int count = 0;
  for (Enumeration e = professionInfos.getObjects(); e.hasMoreElements();)
  {
    infos[count++] = ProfessionInfo.getInstance(e.nextElement());
  }
  return infos;
}

代码示例来源:origin: com.madgag.spongycastle/core

private PKIResponse(ASN1Sequence seq)
{
  if (seq.size() != 3)
  {
    throw new IllegalArgumentException("incorrect sequence size");
  }
  this.controlSequence = ASN1Sequence.getInstance(seq.getObjectAt(0));
  this.cmsSequence = ASN1Sequence.getInstance(seq.getObjectAt(1));
  this.otherMsgSequence = ASN1Sequence.getInstance(seq.getObjectAt(2));
}

代码示例来源:origin: com.madgag.spongycastle/core

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

代码示例来源:origin: com.madgag.spongycastle/core

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

代码示例来源:origin: com.madgag.spongycastle/core

private CrlListID(ASN1Sequence seq)
{
  this.crls = (ASN1Sequence)seq.getObjectAt(0);
  Enumeration e = this.crls.getObjects();
  while (e.hasMoreElements())
  {
    CrlValidatedID.getInstance(e.nextElement());
  }
}

代码示例来源:origin: com.madgag/sc-light-jdk15on

public ElGamalParameter(
  ASN1Sequence  seq)
{
  Enumeration     e = seq.getObjects();
  p = (ASN1Integer)e.nextElement();
  g = (ASN1Integer)e.nextElement();
}

代码示例来源:origin: com.madgag.spongycastle/prov

private X509AttributeCertificate readPEMCertificate(
  InputStream  in)
  throws IOException
{
  ASN1Sequence seq = PEM_PARSER.readPEMObject(in);
  if (seq != null)
  {
    return new X509V2AttributeCertificate(seq.getEncoded());
  }
  return null;
}

代码示例来源:origin: com.madgag.spongycastle/core

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

代码示例来源:origin: com.madgag.spongycastle/core

private CompleteRevocationRefs(ASN1Sequence seq)
{
  Enumeration seqEnum = seq.getObjects();
  while (seqEnum.hasMoreElements())
  {
    CrlOcspRef.getInstance(seqEnum.nextElement());
  }
  this.crlOcspRefs = seq;
}

代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on

public byte[] getEncoded()
  throws IOException
{
  return Arrays.concatenate(certificateHolder.getEncoded(), trustBlock.toASN1Sequence().getEncoded());
}

代码示例来源:origin: com.madgag.spongycastle/core

private SafeBag(
  ASN1Sequence    seq)
{
  this.bagId = (ASN1ObjectIdentifier)seq.getObjectAt(0);
  this.bagValue = ((ASN1TaggedObject)seq.getObjectAt(1)).getObject();
  if (seq.size() == 3)
  {
    this.bagAttributes = (ASN1Set)seq.getObjectAt(2);
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

private Signature(
  ASN1Sequence    seq)
{
  signatureAlgorithm  = AlgorithmIdentifier.getInstance(seq.getObjectAt(0));
  signature = (DERBitString)seq.getObjectAt(1);
  if (seq.size() == 3)
  {
    certs = ASN1Sequence.getInstance(
              (ASN1TaggedObject)seq.getObjectAt(2), true);
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

static BEROctetString fromSequence(ASN1Sequence seq)
  {
    ASN1OctetString[]     v = new ASN1OctetString[seq.size()];
    Enumeration e = seq.getObjects();
    int                   index = 0;

    while (e.hasMoreElements())
    {
      v[index++] = (ASN1OctetString)e.nextElement();
    }

    return new BEROctetString(v);
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

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

代码示例来源:origin: com.madgag.spongycastle/core

private ContentInfo(
  ASN1Sequence  seq)
{
  Enumeration   e = seq.getObjects();
  contentType = (ASN1ObjectIdentifier)e.nextElement();
  if (e.hasMoreElements())
  {
    content = ((ASN1TaggedObject)e.nextElement()).getObject();
  }
  isBer = seq instanceof BERSequence;
}

代码示例来源:origin: com.madgag.spongycastle/core

private CertificatePolicies(
  ASN1Sequence  seq)
{
  this.policyInformation = new PolicyInformation[seq.size()];
  for (int i = 0; i != seq.size(); i++)
  {
    policyInformation[i] = PolicyInformation.getInstance(seq.getObjectAt(i));
  }
}

代码示例来源:origin: com.madgag/sc-light-jdk15on

private Signature(
  ASN1Sequence    seq)
{
  signatureAlgorithm  = AlgorithmIdentifier.getInstance(seq.getObjectAt(0));
  signature = (DERBitString)seq.getObjectAt(1);
  if (seq.size() == 3)
  {
    certs = ASN1Sequence.getInstance(
              (ASN1TaggedObject)seq.getObjectAt(2), true);
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

private X500Name(
  X500NameStyle style,
  ASN1Sequence  seq)
{
  this.style = style;
  this.rdns = new RDN[seq.size()];
  int index = 0;
  for (Enumeration e = seq.getObjects(); e.hasMoreElements();)
  {
    rdns[index++] = RDN.getInstance(e.nextElement());
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

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

相关文章