Request.java
上传用户:lior1029
上传日期:2013-05-07
资源大小:209k
文件大小:1k
源码类别:

CA认证

开发平台:

Java

  1. package org.bouncycastle.asn1.ocsp;
  2. import org.bouncycastle.asn1.ASN1Sequence;
  3. import org.bouncycastle.asn1.ASN1TaggedObject;
  4. import org.bouncycastle.asn1.DERObject;
  5. import org.bouncycastle.asn1.DERTaggedObject;
  6. import org.bouncycastle.asn1.DERSequence;
  7. import org.bouncycastle.asn1.DEREncodable;
  8. import org.bouncycastle.asn1.ASN1EncodableVector;
  9. import org.bouncycastle.asn1.x509.X509Extensions;
  10. public class Request
  11.     implements DEREncodable
  12. {
  13. CertID     reqCert;
  14. X509Extensions singleRequestExtensions;
  15. public Request(
  16. ASN1Sequence seq)
  17. {
  18. reqCert = CertID.getInstance(seq.getObjectAt(0));
  19. if (seq.size() == 2)
  20. {
  21. singleRequestExtensions = X509Extensions.getInstance(
  22. (ASN1TaggedObject)seq.getObjectAt(1), true);
  23. }
  24. }
  25. public CertID getReqCert()
  26. {
  27. return reqCert;
  28. }
  29. public X509Extensions getSingleRequestExtensions()
  30. {
  31. return singleRequestExtensions;
  32. }
  33. /**
  34.  * <pre>
  35.  * Request         ::=     SEQUENCE {
  36.  *     reqCert                     CertID,
  37.  *     singleRequestExtensions     [0] EXPLICIT Extensions OPTIONAL }
  38.  * </pre>
  39.  */
  40. public DERObject getDERObject()
  41. {
  42. ASN1EncodableVector v = new ASN1EncodableVector();
  43. v.add(reqCert);
  44. if (singleRequestExtensions != null)
  45. {
  46. v.add(new DERTaggedObject(true, 0, singleRequestExtensions));
  47. }
  48. return new DERSequence(v);
  49. }
  50. }