public SafeBag( DerObjectIdentifier oid, Asn1Object obj) { this.bagID = oid; this.bagValue = obj; this.bagAttributes = null; }
public SafeBag( DerObjectIdentifier oid, Asn1Object obj, Asn1Set bagAttributes) { this.bagID = oid; this.bagValue = obj; this.bagAttributes = bagAttributes; }
public SmimeCapability( Asn1Sequence seq) { capabilityID = (DerObjectIdentifier) seq[0].ToAsn1Object(); if (seq.Count > 1) { parameters = seq[1].ToAsn1Object(); } }
private ServiceLocator( Asn1Sequence seq) { this.issuer = X509Name.GetInstance(seq[0]); if (seq.Count > 1) { this.locator = seq[1].ToAsn1Object(); } }
public ServiceLocator( X509Name issuer, Asn1Object locator) { if (issuer == null) throw new ArgumentNullException("issuer"); this.issuer = issuer; this.locator = locator; }
protected override bool Asn1Equals( Asn1Object asn1Object) { DerGeneralString other = asn1Object as DerGeneralString; if (other == null) return false; return this.str.Equals(other.str); }
public SafeBag( Asn1Sequence seq) { this.bagID = (DerObjectIdentifier) seq[0]; this.bagValue = ((DerTaggedObject) seq[1]).GetObject(); if (seq.Count == 3) { this.bagAttributes = (Asn1Set) seq[2]; } }
public Time( Asn1Object time) { if (!(time is DerUtcTime) && !(time is DerGeneralizedTime)) { throw new ArgumentException("unknown object passed to Time"); } this.time = time; }
public virtual void WriteObject( Asn1Object obj) { if (obj == null) { WriteNull(); } else { obj.Encode(this); } }
public SmimeCapability( DerObjectIdentifier capabilityID, Asn1Encodable parameters) { if (capabilityID == null) throw new ArgumentNullException("capabilityID"); this.capabilityID = capabilityID; if (parameters != null) { this.parameters = parameters.ToAsn1Object(); } }
/** * Creates a new <code>CommitmentTypeQualifier</code> instance. * * @param commitmentTypeIdentifier a <code>CommitmentTypeIdentifier</code> value * @param qualifier the qualifier, defined by the above field. */ public CommitmentTypeQualifier( DerObjectIdentifier commitmentTypeIdentifier, Asn1Encodable qualifier) { if (commitmentTypeIdentifier == null) throw new ArgumentNullException("commitmentTypeIdentifier"); this.commitmentTypeIdentifier = commitmentTypeIdentifier; if (qualifier != null) { this.qualifier = qualifier.ToAsn1Object(); } }
/** * Creates a new <code>CommitmentTypeQualifier</code> instance. * * @param as <code>CommitmentTypeQualifier</code> structure * encoded as an Asn1Sequence. */ public CommitmentTypeQualifier( Asn1Sequence seq) { if (seq == null) throw new ArgumentNullException("seq"); if (seq.Count < 1 || seq.Count > 2) throw new ArgumentException("Bad sequence size: " + seq.Count, "seq"); commitmentTypeIdentifier = (DerObjectIdentifier) seq[0].ToAsn1Object(); if (seq.Count > 1) { qualifier = seq[1].ToAsn1Object(); } }
/** * creates a time object from a given date - if the date is between 1950 * and 2049 a UTCTime object is Generated, otherwise a GeneralizedTime * is used. */ public Time( DateTime date) { string d = date.ToString("yyyyMMddHHmmss") + "Z"; int year = int.Parse(d.Substring(0, 4)); if (year < 1950 || year > 2049) { time = new DerGeneralizedTime(d); } else { time = new DerUtcTime(d.Substring(2)); } }
public DerExternal( Asn1EncodableVector vector) { int offset = 0; Asn1Object enc = GetObjFromVector(vector, offset); if (enc is DerObjectIdentifier) { directReference = (DerObjectIdentifier)enc; offset++; enc = GetObjFromVector(vector, offset); } if (enc is DerInteger) { indirectReference = (DerInteger) enc; offset++; enc = GetObjFromVector(vector, offset); } if (!(enc is DerTaggedObject)) { dataValueDescriptor = (Asn1Object) enc; offset++; enc = GetObjFromVector(vector, offset); } if (!(enc is DerTaggedObject)) { throw new InvalidOperationException( "No tagged object found in vector. Structure doesn't seem to be of type External"); } if (vector.Count != offset + 1) throw new ArgumentException("input vector too large", "vector"); if (!(enc is DerTaggedObject)) throw new ArgumentException("No tagged object found in vector. Structure doesn't seem to be of type External", "vector"); DerTaggedObject obj = (DerTaggedObject)enc; // Use property accessor to include check on value Encoding = obj.TagNo; if (encoding < 0 || encoding > 2) throw new InvalidOperationException("invalid encoding value"); externalContent = obj.GetObject(); }
public RecipientIdentifier( Asn1Object id) { this.id = id; }
public SignerIdentifier( Asn1Object id) { this.id = id; }
public OriginatorIdentifierOrKey( Asn1Object id) { this.id = id; }
protected abstract bool Asn1Equals(Asn1Object asn1Object);
protected override bool Asn1Equals( Asn1Object asn1Object) { DerGeneralizedTime other = asn1Object as DerGeneralizedTime; if (other == null) return false; return this.time.Equals(other.time); }
protected override bool Asn1Equals( Asn1Object asn1Object) { DerEnumerated other = asn1Object as DerEnumerated; if (other == null) return false; return Arrays.AreEqual(this.bytes, other.bytes); }
protected override bool Asn1Equals( Asn1Object asn1Object) { DerBitString other = asn1Object as DerBitString; if (other == null) return false; return this.padBits == other.padBits && Arrays.AreEqual(this.data, other.data); }
protected override bool Asn1Equals( Asn1Object asn1Object) { DerOctetString other = asn1Object as DerOctetString; if (other == null) return false; return Arrays.AreEqual(GetOctets(), other.GetOctets()); }
protected override bool Asn1Equals( Asn1Object asn1Object) { if (this == asn1Object) return true; DerExternal other = asn1Object as DerExternal; if (other == null) return false; return Platform.Equals(directReference, other.directReference) && Platform.Equals(indirectReference, other.indirectReference) && Platform.Equals(dataValueDescriptor, other.dataValueDescriptor) && externalContent.Equals(other.externalContent); }
protected override bool Asn1Equals( Asn1Object asn1Object) { DerApplicationSpecific other = asn1Object as DerApplicationSpecific; if (other == null) return false; return this.isConstructed == other.isConstructed && this.tag == other.tag && Arrays.AreEqual(this.octets, other.octets); }
protected override bool Asn1Equals( Asn1Object asn1Object) { Asn1TaggedObject other = asn1Object as Asn1TaggedObject; if (other == null) return false; return this.tagNo == other.tagNo // && this.empty == other.empty && this.explicitly == other.explicitly // TODO Should this be part of equality? && Platform.Equals(GetObject(), other.GetObject()); }
public BerOctetString( Asn1Object obj) : base(obj) { }
protected override bool Asn1Equals( Asn1Object asn1Object) { return asn1Object is DerNull; }
/** * Creates a new instance of DerExternal * See X.690 for more informations about the meaning of these parameters * @param directReference The direct reference or <code>null</code> if not set. * @param indirectReference The indirect reference or <code>null</code> if not set. * @param dataValueDescriptor The data value descriptor or <code>null</code> if not set. * @param externalData The external data in its encoded form. */ public DerExternal(DerObjectIdentifier directReference, DerInteger indirectReference, Asn1Object dataValueDescriptor, DerTaggedObject externalData) : this(directReference, indirectReference, dataValueDescriptor, externalData.TagNo, externalData.ToAsn1Object()) { }
protected override bool Asn1Equals( Asn1Object asn1Object) { DerUniversalString other = asn1Object as DerUniversalString; if (other == null) return false; // return this.GetString().Equals(other.GetString()); return Arrays.AreEqual(this.str, other.str); }
/** * Creates a new instance of DerExternal. * See X.690 for more informations about the meaning of these parameters * @param directReference The direct reference or <code>null</code> if not set. * @param indirectReference The indirect reference or <code>null</code> if not set. * @param dataValueDescriptor The data value descriptor or <code>null</code> if not set. * @param encoding The encoding to be used for the external data * @param externalData The external data */ public DerExternal(DerObjectIdentifier directReference, DerInteger indirectReference, Asn1Object dataValueDescriptor, int encoding, Asn1Object externalData) { DirectReference = directReference; IndirectReference = indirectReference; DataValueDescriptor = dataValueDescriptor; Encoding = encoding; ExternalContent = externalData.ToAsn1Object(); }