/// <summary> /// Add an extension to this certificate. /// </summary> /// <param name="oid">Its Object Identifier.</param> /// <param name="critical">Is it critical.</param> /// <param name="extensionValue">The value.</param> public void AddExtension( DerObjectIdentifier oid, bool critical, Asn1Encodable extensionValue) { extGenerator.AddExtension(oid, critical, extensionValue); }
public ContentInfo( DerObjectIdentifier contentType, Asn1Encodable content) { this.contentType = contentType; this.content = content; }
internal static void SetSignatureParameters( ISigner signature, Asn1Encodable parameters) { if (parameters != null && !derNull.Equals(parameters)) { // TODO Put back in // AlgorithmParameters sigParams = AlgorithmParameters.GetInstance(signature.getAlgorithm()); // // try // { // sigParams.Init(parameters.ToAsn1Object().GetDerEncoded()); // } // catch (IOException e) // { // throw new SignatureException("IOException decoding parameters: " + e.Message); // } // // if (Platform.EndsWith(signature.getAlgorithm(), "MGF1")) // { // try // { // signature.setParameter(sigParams.getParameterSpec(PSSParameterSpec.class)); // } // catch (GeneralSecurityException e) // { // throw new SignatureException("Exception extracting parameters: " + e.Message); // } // } } }
public void AddExtension( string oid, bool critical, Asn1Encodable value) { this.AddExtension(oid, critical, value.GetEncoded()); }
/// <summary> /// Add a given extension field for the standard extensions tag (tag 3). /// </summary> /// <param name="oid">string containing a dotted decimal Object Identifier.</param> /// <param name="critical">Is it critical.</param> /// <param name="extensionValue">The value.</param> public void AddExtension( string oid, bool critical, Asn1Encodable extensionValue) { extGenerator.AddExtension(new DerObjectIdentifier(oid), critical, extensionValue); }
public CertStatus( int tagNo, Asn1Encodable value) { this.tagNo = tagNo; this.value = value; }
/** * @param explicitly true if an explicitly tagged object. * @param tagNo the tag number for this object. * @param obj the tagged object. */ public BerTaggedObject( bool explicitly, int tagNo, Asn1Encodable obj) : base(explicitly, tagNo, obj) { }
/** * 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) { this.commitmentTypeIdentifier = commitmentTypeIdentifier; this.qualifier = qualifier; }
/** * add a given extension field for the standard extensions tag (tag 3) * @throws IOException */ public virtual void AddExtension( DerObjectIdentifier oid, bool critical, Asn1Encodable extValue) { this.AddExtension(oid, critical, extValue.GetEncoded()); }
public QCStatement( DerObjectIdentifier qcStatementId, Asn1Encodable qcStatementInfo) { this.qcStatementId = qcStatementId; this.qcStatementInfo = qcStatementInfo; }
public OtherRecipientInfo( DerObjectIdentifier oriType, Asn1Encodable oriValue) { this.oriType = oriType; this.oriValue = oriValue; }
public SmimeCapability( DerObjectIdentifier capabilityID, Asn1Encodable parameters) { this.capabilityID = capabilityID; this.parameters = parameters; }
public OtherKeyAttribute( DerObjectIdentifier keyAttrId, Asn1Encodable keyAttr) { this.keyAttrId = keyAttrId; this.keyAttr = keyAttr; }
public DerApplicationSpecific( int tag, Asn1Encodable obj) { this.tag = tag | Asn1Tags.Constructed; this.octets = obj.GetDerEncoded(); }
public ResponderID( Asn1OctetString id) { if (id == null) throw new ArgumentNullException("id"); this.id = id; }
public ResponderID( X509Name id) { if (id == null) throw new ArgumentNullException("id"); this.id = id; }
/** * @param tagNo the tag number for this object. * @param obj the tagged object. */ protected Asn1TaggedObject( int tagNo, Asn1Encodable obj) { this.explicitly = true; this.tagNo = tagNo; this.obj = obj; }
/** * @param explicitly true if the object is explicitly tagged. * @param tagNo the tag number for this object. * @param obj the tagged object. */ protected Asn1TaggedObject( bool explicitly, int tagNo, Asn1Encodable obj) { this.explicitly = explicitly; this.tagNo = tagNo; this.obj = obj; }
/** * Creates a new <code>CommitmentTypeQualifier</code> instance. * * @param as <code>CommitmentTypeQualifier</code> structure * encoded as an Asn1Sequence. */ public CommitmentTypeQualifier( Asn1Sequence asSeq) { commitmentTypeIdentifier = (DerObjectIdentifier)asSeq[0]; if (asSeq.Count > 1) { qualifier = asSeq[1]; } }
private QCStatement( Asn1Sequence seq) { qcStatementId = DerObjectIdentifier.GetInstance(seq[0]); if (seq.Count > 1) { qcStatementInfo = seq[1]; } }
public SmimeCapability( Asn1Sequence seq) { capabilityID = (DerObjectIdentifier) seq[0]; if (seq.Count > 1) { parameters = (Asn1Object) seq[1]; } }
public Iso4217CurrencyCode( string alphabetic) { if (alphabetic.Length > AlphabeticMaxSize) { throw new ArgumentException("wrong size in alphabetic code : max size is " + AlphabeticMaxSize); } obj = new DerPrintableString(alphabetic); }
public Iso4217CurrencyCode( int numeric) { if (numeric > NumericMaxSize || numeric < NumericMinSize) { throw new ArgumentException("wrong size in numeric code : not in (" +NumericMinSize +".."+ NumericMaxSize +")"); } obj = new DerInteger(numeric); }
/** * @param explicitly true if the object is explicitly tagged. * @param tagNo the tag number for this object. * @param obj the tagged object. */ protected Asn1TaggedObject( bool explicitly, int tagNo, Asn1Encodable obj) { // IAsn1Choice marker interface 'insists' on explicit tagging this.explicitly = explicitly || (obj is IAsn1Choice); this.tagNo = tagNo; this.obj = obj; }
private ContentInfo( Asn1Sequence seq) { contentType = (DerObjectIdentifier) seq[0]; if (seq.Count > 1) { content = ((Asn1TaggedObject) seq[1]).GetObject(); } }
public Asn1Encodable[] GetValues() { Asn1Set s = attr.AttrValues; Asn1Encodable[] values = new Asn1Encodable[s.Count]; for (int i = 0; i != s.Count; i++) { values[i] = (Asn1Encodable)s[i]; } return values; }
internal Asn1OctetString( Asn1Encodable obj) { try { this.str = obj.GetDerEncoded(); } catch (IOException e) { throw new ArgumentException("Error processing object : " + e.ToString()); } }
public TypeOfBiometricData( int predefinedBiometricType) { if (predefinedBiometricType == Picture || predefinedBiometricType == HandwrittenSignature) { obj = new DerInteger(predefinedBiometricType); } else { throw new ArgumentException("unknow PredefinedBiometricType : " + predefinedBiometricType); } }
public virtual void WriteObject( Asn1Encodable obj) { if (obj == null) { WriteNull(); } else { obj.ToAsn1Object().Encode(this); } }
/** * 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(); } }
public DerOctetString(Asn1Encodable obj) : base(obj) { }
public DerBitString( Asn1Encodable obj) { this.data = obj.GetDerEncoded(); //this.padBits = 0; }
protected internal void AddObject( Asn1Encodable obj) { seq.Add(obj); }
public override void AddObject( Asn1Encodable obj) { new DerOutputStream(_bOut).WriteObject(obj); }
/** * build an object given its tag and a byte stream to construct it * from. */ internal Asn1Object BuildObject( int tag, int tagNo, byte[] bytes) { if ((tag & Asn1Tags.Application) != 0) { return(new DerApplicationSpecific(tagNo, bytes)); } switch (tag) { case Asn1Tags.Null: return(DerNull.Instance); case Asn1Tags.Sequence | Asn1Tags.Constructed: { Asn1EncodableVector v = BuildDerEncodableVector(bytes); return(new DerSequence(v)); } case Asn1Tags.Set | Asn1Tags.Constructed: { Asn1EncodableVector v = BuildDerEncodableVector(bytes); return(new DerSet(v, false)); } case Asn1Tags.Boolean: return(new DerBoolean(bytes)); case Asn1Tags.Integer: return(new DerInteger(bytes)); case Asn1Tags.Enumerated: return(new DerEnumerated(bytes)); case Asn1Tags.ObjectIdentifier: return(new DerObjectIdentifier(bytes)); case Asn1Tags.BitString: { int padBits = bytes[0]; byte[] data = new byte[bytes.Length - 1]; Array.Copy(bytes, 1, data, 0, bytes.Length - 1); return(new DerBitString(data, padBits)); } case Asn1Tags.NumericString: return(new DerNumericString(bytes)); case Asn1Tags.Utf8String: return(new DerUtf8String(bytes)); case Asn1Tags.PrintableString: return(new DerPrintableString(bytes)); case Asn1Tags.IA5String: return(new DerIA5String(bytes)); case Asn1Tags.T61String: return(new DerT61String(bytes)); case Asn1Tags.VisibleString: return(new DerVisibleString(bytes)); case Asn1Tags.GeneralString: return(new DerGeneralString(bytes)); case Asn1Tags.UniversalString: return(new DerUniversalString(bytes)); case Asn1Tags.BmpString: return(new DerBmpString(bytes)); case Asn1Tags.OctetString: return(new DerOctetString(bytes)); case Asn1Tags.OctetString | Asn1Tags.Constructed: return(BuildDerConstructedOctetString(bytes)); case Asn1Tags.UtcTime: return(new DerUtcTime(bytes)); case Asn1Tags.GeneralizedTime: return(new DerGeneralizedTime(bytes)); default: { // // with tagged object tag number is bottom 5 bits // if ((tag & (int)Asn1Tags.Tagged) != 0) { bool isImplicit = ((tag & (int)Asn1Tags.Constructed) == 0); if (bytes.Length == 0) // empty tag! { Asn1Encodable ae = isImplicit ? (Asn1Encodable)DerNull.Instance : new DerSequence(); return(new DerTaggedObject(false, tagNo, ae)); } // // simple type - implicit... return an octet string // if (isImplicit) { return(new DerTaggedObject(false, tagNo, new DerOctetString(bytes))); } Asn1InputStream aIn = new Asn1InputStream(bytes); Asn1Encodable dObj = aIn.ReadObject(); // explicitly tagged (probably!) - if it isn't we'd have to // tell from the context //if (aIn.available() == 0) if (aIn.Position == bytes.Length) //FIXME? { return(new DerTaggedObject(tagNo, dObj)); } // // another implicit object, we'll create a sequence... // Asn1EncodableVector v = new Asn1EncodableVector(); while (dObj != null) { v.Add(dObj); dObj = aIn.ReadObject(); } return(new DerTaggedObject(false, tagNo, new DerSequence(v))); } return(new DerUnknownTag(tag, bytes)); } } }
/** * @param obj - a single object that makes up the set. */ public DerSet( Asn1Encodable obj) : base(1) { AddObject(obj); }
public DerBitString( Asn1Encodable obj) : this(obj.GetDerEncoded()) { }
/** * create a sequence containing one object */ public DerSequence(Asn1Encodable element) : base(element) { }
public BerBitString(Asn1Encodable obj) : base(obj) { }
public DerApplicationSpecific( int tag, Asn1Encodable obj) : this(true, tag, obj) { }
/** * create a set containing one object */ public BerSet(Asn1Encodable obj) : base(obj) { }
/** * @param tagNo the tag number for this object. * @param obj the tagged object. */ public BerTaggedObject( int tagNo, Asn1Encodable obj) : base(tagNo, obj) { }
public BerOctetString( Asn1Encodable obj) : base(obj.ToAsn1Object()) { }
public abstract void AddObject(Asn1Encodable obj);