Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.x509;
  
The TBSCertificate object.
 TBSCertificate ::= SEQUENCE {
      version          [ 0 ]  Version DEFAULT v1(0),
      serialNumber            CertificateSerialNumber,
      signature               AlgorithmIdentifier,
      issuer                  Name,
      validity                Validity,
      subject                 Name,
      subjectPublicKeyInfo    SubjectPublicKeyInfo,
      issuerUniqueID    [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
      subjectUniqueID   [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
      extensions        [ 3 ] Extensions OPTIONAL
      }
 

Note: issuerUniqueID and subjectUniqueID are both deprecated by the IETF. This class will parse them, but you really shouldn't be creating new ones.

 
 public class TBSCertificate
     extends ASN1Object
 {
     ASN1Sequence            seq;
 
     ASN1Integer             version;
     ASN1Integer             serialNumber;
     AlgorithmIdentifier     signature;
     X500Name                issuer;
     Time                    startDateendDate;
     X500Name                subject;
     DERBitString            issuerUniqueId;
     DERBitString            subjectUniqueId;
     Extensions              extensions;
 
     public static TBSCertificate getInstance(
         ASN1TaggedObject obj,
         boolean          explicit)
     {
         return getInstance(ASN1Sequence.getInstance(objexplicit));
     }
 
     public static TBSCertificate getInstance(
         Object  obj)
     {
         if (obj instanceof TBSCertificate)
         {
             return (TBSCertificate)obj;
         }
         else if (obj != null)
         {
             return new TBSCertificate(ASN1Sequence.getInstance(obj));
         }
 
         return null;
     }
 
     private TBSCertificate(
         ASN1Sequence seq)
     {
         int         seqStart = 0;
 
         this. = seq;
 
         //
         // some certficates don't include a version number - we assume v1
         //
         if (seq.getObjectAt(0) instanceof DERTaggedObject)
         {
              = ASN1Integer.getInstance((ASN1TaggedObject)seq.getObjectAt(0), true);
         }
         else
         {
             seqStart = -1;          // field 0 is missing!
              = new ASN1Integer(0);
         }
 
          = ASN1Integer.getInstance(seq.getObjectAt(seqStart + 1));
 
          = AlgorithmIdentifier.getInstance(seq.getObjectAt(seqStart + 2));
          = X500Name.getInstance(seq.getObjectAt(seqStart + 3));
 
         //
         // before and after dates
         //
         ASN1Sequence  dates = (ASN1Sequence)seq.getObjectAt(seqStart + 4);
 
         = Time.getInstance(dates.getObjectAt(0));
         = Time.getInstance(dates.getObjectAt(1));
         = X500Name.getInstance(seq.getObjectAt(seqStart + 5));
        //
        // public key info.
        //
         = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(seqStart + 6));
        for (int extras = seq.size() - (seqStart + 6) - 1; extras > 0; extras--)
        {
            DERTaggedObject extra = (DERTaggedObject)seq.getObjectAt(seqStart + 6 + extras);
            switch (extra.getTagNo())
            {
            case 1:
                 = DERBitString.getInstance(extrafalse);
                break;
            case 2:
                 = DERBitString.getInstance(extrafalse);
                break;
            case 3:
                 = Extensions.getInstance(ASN1Sequence.getInstance(extratrue));
            }
        }
    }
    public int getVersionNumber()
    {
        return .getValue().intValue() + 1;
    }
    public ASN1Integer getVersion()
    {
        return ;
    }
    public ASN1Integer getSerialNumber()
    {
        return ;
    }
    {
        return ;
    }
    public X500Name getIssuer()
    {
        return ;
    }
    public Time getStartDate()
    {
        return ;
    }
    public Time getEndDate()
    {
        return ;
    }
    public X500Name getSubject()
    {
        return ;
    }
    {
        return ;
    }
    {
        return ;
    }
    {
        return ;
    }
    public Extensions getExtensions()
    {
        return ;
    }
    {
        return ;
    }
New to GrepCode? Check out our FAQ X