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

CA认证

开发平台:

Java

  1. package org.bouncycastle.asn1.pkcs;
  2. import java.io.*;
  3. import java.util.*;
  4. import org.bouncycastle.asn1.*;
  5. import org.bouncycastle.asn1.x509.*;
  6. /**
  7.  * PKCS10
  8.  *
  9.  * <pre>
  10.  * CertificationRequest ::= SEQUENCE {
  11.  *   certificationRequestInfo  CertificationRequestInfo,
  12.  *   signatureAlgorithm        AlgorithmIdentifier{{ SignatureAlgorithms }},
  13.  *   signature                 BIT STRING
  14.  * }
  15.  * </pre>
  16.  */
  17. public class CertificationRequest
  18.     implements DEREncodable
  19. {
  20.     protected CertificationRequestInfo reqInfo = null;
  21.     protected AlgorithmIdentifier sigAlgId = null;
  22.     protected DERBitString sigBits = null;
  23.     protected CertificationRequest()
  24.     {
  25.     }
  26.     public CertificationRequest(
  27.         CertificationRequestInfo requestInfo,
  28.         AlgorithmIdentifier     algorithm,
  29.         DERBitString            signature)
  30.     {
  31.         this.reqInfo = requestInfo;
  32.         this.sigAlgId = algorithm;
  33.         this.sigBits = signature;
  34.     }
  35.     public CertificationRequest(
  36.         ASN1Sequence seq)
  37.     {
  38.         reqInfo = CertificationRequestInfo.getInstance(seq.getObjectAt(0));
  39.         sigAlgId = AlgorithmIdentifier.getInstance(seq.getObjectAt(1));
  40.         sigBits = (DERBitString)seq.getObjectAt(2);
  41.     }
  42.     public CertificationRequestInfo getCertificationRequestInfo()
  43.     {
  44.         return reqInfo;
  45.     }
  46.     public AlgorithmIdentifier getSignatureAlgorithm()
  47.     {
  48.         return sigAlgId;
  49.     }
  50.     public DERBitString getSignature()
  51.     {
  52.         return sigBits;
  53.     }
  54.     public DERObject getDERObject()
  55.     {
  56.         // Construct the CertificateRequest
  57.         ASN1EncodableVector  v = new ASN1EncodableVector();
  58.         v.add(reqInfo);
  59.         v.add(sigAlgId);
  60.         v.add(sigBits);
  61.         return new DERSequence(v);
  62.     }
  63. }