diff options
author | Peter Dettman <peter.dettman@gmail.com> | 2022-06-21 18:57:52 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@gmail.com> | 2022-06-21 18:57:52 +0700 |
commit | 84a1abd2bb12af82623c136243240e52a88e0bf4 (patch) | |
tree | 5a9828c8785a54c5b293ba484bdd0e2f2431600f /crypto/src/asn1/ess | |
parent | Update copyright (diff) | |
download | BouncyCastle.NET-ed25519-84a1abd2bb12af82623c136243240e52a88e0bf4.tar.xz |
ObsoleteAttribute cleanup
Diffstat (limited to 'crypto/src/asn1/ess')
-rw-r--r-- | crypto/src/asn1/ess/OtherCertID.cs | 129 | ||||
-rw-r--r-- | crypto/src/asn1/ess/OtherSigningCertificate.cs | 105 |
2 files changed, 0 insertions, 234 deletions
diff --git a/crypto/src/asn1/ess/OtherCertID.cs b/crypto/src/asn1/ess/OtherCertID.cs deleted file mode 100644 index 183055e56..000000000 --- a/crypto/src/asn1/ess/OtherCertID.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; - -using Org.BouncyCastle.Asn1.Oiw; -using Org.BouncyCastle.Asn1.X509; -using Org.BouncyCastle.Utilities; - -namespace Org.BouncyCastle.Asn1.Ess -{ - [Obsolete("Use version in Asn1.Esf instead")] - public class OtherCertID - : Asn1Encodable - { - private Asn1Encodable otherCertHash; - private IssuerSerial issuerSerial; - - public static OtherCertID GetInstance( - object o) - { - if (o == null || o is OtherCertID) - { - return (OtherCertID) o; - } - - if (o is Asn1Sequence) - { - return new OtherCertID((Asn1Sequence) o); - } - - throw new ArgumentException( - "unknown object in 'OtherCertID' factory : " - + Platform.GetTypeName(o) + "."); - } - - /** - * constructor - */ - public OtherCertID( - Asn1Sequence seq) - { - if (seq.Count < 1 || seq.Count > 2) - { - throw new ArgumentException("Bad sequence size: " + seq.Count); - } - - if (seq[0].ToAsn1Object() is Asn1OctetString) - { - otherCertHash = Asn1OctetString.GetInstance(seq[0]); - } - else - { - otherCertHash = DigestInfo.GetInstance(seq[0]); - } - - if (seq.Count > 1) - { - issuerSerial = IssuerSerial.GetInstance(Asn1Sequence.GetInstance(seq[1])); - } - } - - public OtherCertID( - AlgorithmIdentifier algId, - byte[] digest) - { - this.otherCertHash = new DigestInfo(algId, digest); - } - - public OtherCertID( - AlgorithmIdentifier algId, - byte[] digest, - IssuerSerial issuerSerial) - { - this.otherCertHash = new DigestInfo(algId, digest); - this.issuerSerial = issuerSerial; - } - - public AlgorithmIdentifier AlgorithmHash - { - get - { - if (otherCertHash.ToAsn1Object() is Asn1OctetString) - { - // SHA-1 - return new AlgorithmIdentifier(OiwObjectIdentifiers.IdSha1); - } - - return DigestInfo.GetInstance(otherCertHash).AlgorithmID; - } - } - - public byte[] GetCertHash() - { - if (otherCertHash.ToAsn1Object() is Asn1OctetString) - { - // SHA-1 - return ((Asn1OctetString) otherCertHash.ToAsn1Object()).GetOctets(); - } - - return DigestInfo.GetInstance(otherCertHash).GetDigest(); - } - - public IssuerSerial IssuerSerial - { - get { return issuerSerial; } - } - - /** - * <pre> - * OtherCertID ::= SEQUENCE { - * otherCertHash OtherHash, - * issuerSerial IssuerSerial OPTIONAL } - * - * OtherHash ::= CHOICE { - * sha1Hash OCTET STRING, - * otherHash OtherHashAlgAndValue } - * - * OtherHashAlgAndValue ::= SEQUENCE { - * hashAlgorithm AlgorithmIdentifier, - * hashValue OCTET STRING } - * - * </pre> - */ - public override Asn1Object ToAsn1Object() - { - Asn1EncodableVector v = new Asn1EncodableVector(otherCertHash); - v.AddOptional(issuerSerial); - return new DerSequence(v); - } - } -} diff --git a/crypto/src/asn1/ess/OtherSigningCertificate.cs b/crypto/src/asn1/ess/OtherSigningCertificate.cs deleted file mode 100644 index 65152b675..000000000 --- a/crypto/src/asn1/ess/OtherSigningCertificate.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; - -using Org.BouncyCastle.Asn1.X509; -using Org.BouncyCastle.Utilities; - -namespace Org.BouncyCastle.Asn1.Ess -{ - [Obsolete("Use version in Asn1.Esf instead")] - public class OtherSigningCertificate - : Asn1Encodable - { - private Asn1Sequence certs, policies; - - public static OtherSigningCertificate GetInstance( - object o) - { - if (o == null || o is OtherSigningCertificate) - { - return (OtherSigningCertificate) o; - } - - if (o is Asn1Sequence) - { - return new OtherSigningCertificate((Asn1Sequence) o); - } - - throw new ArgumentException( - "unknown object in 'OtherSigningCertificate' factory : " - + Platform.GetTypeName(o) + "."); - } - - /** - * constructors - */ - public OtherSigningCertificate( - Asn1Sequence seq) - { - if (seq.Count < 1 || seq.Count > 2) - { - throw new ArgumentException("Bad sequence size: " + seq.Count); - } - - this.certs = Asn1Sequence.GetInstance(seq[0]); - - if (seq.Count > 1) - { - this.policies = Asn1Sequence.GetInstance(seq[1]); - } - } - - public OtherSigningCertificate( - OtherCertID otherCertID) - { - certs = new DerSequence(otherCertID); - } - - public OtherCertID[] GetCerts() - { - OtherCertID[] cs = new OtherCertID[certs.Count]; - - for (int i = 0; i != certs.Count; ++i) - { - cs[i] = OtherCertID.GetInstance(certs[i]); - } - - return cs; - } - - public PolicyInformation[] GetPolicies() - { - if (policies == null) - { - return null; - } - - PolicyInformation[] ps = new PolicyInformation[policies.Count]; - - for (int i = 0; i != policies.Count; i++) - { - ps[i] = PolicyInformation.GetInstance(policies[i]); - } - - return ps; - } - - /** - * The definition of OtherSigningCertificate is - * <pre> - * OtherSigningCertificate ::= SEQUENCE { - * certs SEQUENCE OF OtherCertID, - * policies SEQUENCE OF PolicyInformation OPTIONAL - * } - * </pre> - * id-aa-ets-otherSigCert OBJECT IDENTIFIER ::= { iso(1) - * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) - * smime(16) id-aa(2) 19 } - */ - public override Asn1Object ToAsn1Object() - { - Asn1EncodableVector v = new Asn1EncodableVector(certs); - v.AddOptional(policies); - return new DerSequence(v); - } - } -} |