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

CA认证

开发平台:

Java

  1. package org.bouncycastle.asn1.x509;
  2. import org.bouncycastle.asn1.ASN1Sequence;
  3. import org.bouncycastle.asn1.DERInteger;
  4. import org.bouncycastle.asn1.DERBitString;
  5. import org.bouncycastle.asn1.DERSequence;
  6. import org.bouncycastle.asn1.DERObject;
  7. import org.bouncycastle.asn1.DEREncodable;
  8. import org.bouncycastle.asn1.ASN1EncodableVector;
  9. public class IssuerSerial
  10.     implements DEREncodable
  11. {
  12.     GeneralNames            issuer;
  13.     DERInteger              serial;
  14.     DERBitString            issuerUID;
  15.     public IssuerSerial(
  16.         ASN1Sequence    seq)
  17.     {
  18.         issuer = GeneralNames.getInstance(seq.getObjectAt(0));
  19.         serial = (DERInteger)seq.getObjectAt(1);
  20.         if (seq.size() == 3)
  21.         {
  22.             issuerUID = (DERBitString)seq.getObjectAt(2);
  23.         }
  24.     }
  25.     public GeneralNames getIssuer()
  26.     {
  27.         return issuer;
  28.     }
  29.     public DERInteger getSerial()
  30.     {
  31.         return serial;
  32.     }
  33.     public DERBitString getIssuerUID()
  34.     {
  35.         return issuerUID;
  36.     }
  37.     /**
  38.      * <pre>
  39.      *  IssuerSerial  ::=  SEQUENCE {
  40.      *       issuer         GeneralNames,
  41.      *       serial         CertificateSerialNumber,
  42.      *       issuerUID      UniqueIdentifier OPTIONAL
  43.      *  }
  44.      * </pre>
  45.      */
  46.     public DERObject getDERObject()
  47.     {
  48.         ASN1EncodableVector  v = new ASN1EncodableVector();
  49.         v.add(issuer);
  50.         v.add(serial);
  51.         if (issuerUID != null)
  52.         {
  53.             v.add(issuerUID);
  54.         }
  55.         return new DERSequence(v);
  56.     }
  57. }