Skip to content

Commit

Permalink
missing commit (added PreTBS method)
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Mar 26, 2023
1 parent 7cbf1c4 commit fd44df9
Showing 1 changed file with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,35 @@ public TBSCertList generateTBSCertList()
{
if ((signature == null) || (issuer == null) || (thisUpdate == null))
{
throw new IllegalStateException("Not all mandatory fields set in V2 TBSCertList generator.");
throw new IllegalStateException("not all mandatory fields set in V2 TBSCertList generator");
}

return new TBSCertList(generateTBSCertStructure());
}

public ASN1Sequence generatePreTBSCertList()
{
if (signature != null)
{
throw new IllegalStateException("signature should not be set in PreTBSCertList generator");
}
if ((issuer == null) || (thisUpdate == null))
{
throw new IllegalStateException("not all mandatory fields set in V2 PreTBSCertList generator");
}

return generateTBSCertStructure();
}

private ASN1Sequence generateTBSCertStructure()
{
ASN1EncodableVector v = new ASN1EncodableVector(7);

v.add(version);
v.add(signature);
if (signature != null)
{
v.add(signature);
}
v.add(issuer);

v.add(thisUpdate);
Expand All @@ -237,7 +259,7 @@ public TBSCertList generateTBSCertList()
v.add(new DERTaggedObject(0, extensions));
}

return new TBSCertList(new DERSequence(v));
return new DERSequence(v);
}

private static ASN1Sequence createReasonExtension(int reasonCode)
Expand Down

0 comments on commit fd44df9

Please sign in to comment.