diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-21 19:40:41 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-01-21 19:40:41 +0700 |
commit | 2a947cc7653da44abd23ecbaa86e3013509bc826 (patch) | |
tree | ed2256f7f4310875ea7890e5b949d872bf307bb5 /crypto | |
parent | BMA-116 (diff) | |
download | BouncyCastle.NET-ed25519-2a947cc7653da44abd23ecbaa86e3013509bc826.tar.xz |
Reformat
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/asn1/x509/X509CertificateStructure.cs | 86 |
1 files changed, 42 insertions, 44 deletions
diff --git a/crypto/src/asn1/x509/X509CertificateStructure.cs b/crypto/src/asn1/x509/X509CertificateStructure.cs index e50d3563b..c8558ae61 100644 --- a/crypto/src/asn1/x509/X509CertificateStructure.cs +++ b/crypto/src/asn1/x509/X509CertificateStructure.cs @@ -21,109 +21,107 @@ namespace Org.BouncyCastle.Asn1.X509 private readonly AlgorithmIdentifier sigAlgID; private readonly DerBitString sig; - public static X509CertificateStructure GetInstance( + public static X509CertificateStructure GetInstance( Asn1TaggedObject obj, bool explicitly) { return GetInstance(Asn1Sequence.GetInstance(obj, explicitly)); } - public static X509CertificateStructure GetInstance( + public static X509CertificateStructure GetInstance( object obj) { if (obj is X509CertificateStructure) return (X509CertificateStructure)obj; + if (obj == null) + return null; + return new X509CertificateStructure(Asn1Sequence.GetInstance(obj)); + } - if (obj != null) - return new X509CertificateStructure(Asn1Sequence.GetInstance(obj)); - - return null; + public X509CertificateStructure( + TbsCertificateStructure tbsCert, + AlgorithmIdentifier sigAlgID, + DerBitString sig) + { + if (tbsCert == null) + throw new ArgumentNullException("tbsCert"); + if (sigAlgID == null) + throw new ArgumentNullException("sigAlgID"); + if (sig == null) + throw new ArgumentNullException("sig"); + + this.tbsCert = tbsCert; + this.sigAlgID = sigAlgID; + this.sig = sig; } - public X509CertificateStructure( - TbsCertificateStructure tbsCert, - AlgorithmIdentifier sigAlgID, - DerBitString sig) - { - if (tbsCert == null) - throw new ArgumentNullException("tbsCert"); - if (sigAlgID == null) - throw new ArgumentNullException("sigAlgID"); - if (sig == null) - throw new ArgumentNullException("sig"); - - this.tbsCert = tbsCert; - this.sigAlgID = sigAlgID; - this.sig = sig; - } - - private X509CertificateStructure( + private X509CertificateStructure( Asn1Sequence seq) { - if (seq.Count != 3) - throw new ArgumentException("sequence wrong size for a certificate", "seq"); + if (seq.Count != 3) + throw new ArgumentException("sequence wrong size for a certificate", "seq"); - // + // // correct x509 certficate // - tbsCert = TbsCertificateStructure.GetInstance(seq[0]); - sigAlgID = AlgorithmIdentifier.GetInstance(seq[1]); - sig = DerBitString.GetInstance(seq[2]); + tbsCert = TbsCertificateStructure.GetInstance(seq[0]); + sigAlgID = AlgorithmIdentifier.GetInstance(seq[1]); + sig = DerBitString.GetInstance(seq[2]); } - public TbsCertificateStructure TbsCertificate + public TbsCertificateStructure TbsCertificate { - get { return tbsCert; } + get { return tbsCert; } } - public int Version + public int Version { get { return tbsCert.Version; } } - public DerInteger SerialNumber + public DerInteger SerialNumber { get { return tbsCert.SerialNumber; } } - public X509Name Issuer + public X509Name Issuer { get { return tbsCert.Issuer; } } - public Time StartDate + public Time StartDate { get { return tbsCert.StartDate; } } - public Time EndDate + public Time EndDate { get { return tbsCert.EndDate; } } - public X509Name Subject + public X509Name Subject { get { return tbsCert.Subject; } } - public SubjectPublicKeyInfo SubjectPublicKeyInfo + public SubjectPublicKeyInfo SubjectPublicKeyInfo { get { return tbsCert.SubjectPublicKeyInfo; } } - public AlgorithmIdentifier SignatureAlgorithm + public AlgorithmIdentifier SignatureAlgorithm { get { return sigAlgID; } } - public DerBitString Signature + public DerBitString Signature { get { return sig; } } - public override Asn1Object ToAsn1Object() + public override Asn1Object ToAsn1Object() { - return new DerSequence(tbsCert, sigAlgID, sig); + return new DerSequence(tbsCert, sigAlgID, sig); } - } + } } |