GetDerEncoded() public method

public GetDerEncoded ( ) : byte[]
return byte[]
Example #1
0
 private static void WriteEncodable(MemoryStream ms, Asn1Encodable e)
 {
     if (e != null)
     {
         byte[] derEncoded = e.GetDerEncoded();
         ms.Write(derEncoded, 0, derEncoded.Length);
     }
 }
        public DerApplicationSpecific(
            int				tag,
            Asn1Encodable	obj)
        {
            this.tag = tag | Asn1Tags.Constructed;

            this.octets = obj.GetDerEncoded();
        }
        public DerApplicationSpecific(
            int tag,
            Asn1Encodable obj)
        {
            this.tag = tag | Asn1Tags.Constructed;

            this.octets = obj.GetDerEncoded();
        }
Example #4
0
 internal Asn1OctetString(
     Asn1Encodable obj)
 {
     try
     {
         this.str = obj.GetDerEncoded();
     }
     catch (IOException e)
     {
         throw new ArgumentException("Error processing object : " + e.ToString());
     }
 }
 internal Asn1OctetString(
     Asn1Encodable obj)
 {
     try
     {
         this.str = obj.GetDerEncoded();
     }
     catch (IOException e)
     {
         throw new ArgumentException("Error processing object : " + e.ToString());
     }
 }
		public DerApplicationSpecific(
			bool			isExplicit,
			int				tag,
			Asn1Encodable	obj)
		{
			byte[] data = obj.GetDerEncoded();

			this.isConstructed = isExplicit;
			this.tag = tag;

			if (isExplicit)
			{
				this.octets = data;
			}
			else
			{
				int lenBytes = GetLengthOfLength(data);
				byte[] tmp = new byte[data.Length - lenBytes];
				Array.Copy(data, lenBytes, tmp, 0, tmp.Length);
				this.octets = tmp;
			}
		}
        public DerApplicationSpecific(
            bool isExplicit,
            int tag,
            Asn1Encodable obj)
        {
            byte[] data = obj.GetDerEncoded();

            this.isConstructed = isExplicit;
            this.tag           = tag;

            if (isExplicit)
            {
                this.octets = data;
            }
            else
            {
                int    lenBytes = GetLengthOfLength(data);
                byte[] tmp      = new byte[data.Length - lenBytes];
                Array.Copy(data, lenBytes, tmp, 0, tmp.Length);
                this.octets = tmp;
            }
        }
Example #8
0
 public DerBitString(
     Asn1Encodable obj)
 {
     this.data = obj.GetDerEncoded();
     //this.padBits = 0;
 }
		internal static byte[] GetSignatureForObject(
			DerObjectIdentifier		sigOid, // TODO Redundant now?
			string					sigName,
			AsymmetricKeyParameter	privateKey,
			SecureRandom			random,
			Asn1Encodable			ae)
		{
			if (sigOid == null)
				throw new ArgumentNullException("sigOid");

			ISigner sig = SignerUtilities.GetSigner(sigName);

			if (random != null)
			{
				sig.Init(true, new ParametersWithRandom(privateKey, random));
			}
			else
			{
				sig.Init(true, privateKey);
			}

			byte[] encoded = ae.GetDerEncoded();
			sig.BlockUpdate(encoded, 0, encoded.Length);

			return sig.GenerateSignature();
		}
Example #10
0
 public DerBitString(
     Asn1Encodable obj)
 {
     this.data = obj.GetDerEncoded();
     //            this.padBits = 0;
 }
Example #11
0
 public DerBitString(
     Asn1Encodable obj)
     : this(obj.GetDerEncoded())
 {
 }
Example #12
0
		private static void WriteEncodable(MemoryStream ms, Asn1Encodable e)
		{
			if (e != null)
			{
				byte[] bs = e.GetDerEncoded();
				ms.Write(bs, 0, bs.Length);
			}
		}
Example #13
0
        public DerBitString(
			Asn1Encodable obj)
            : this(obj.GetDerEncoded())
		{
		}
Example #14
0
 public DerBitString(Asn1Encodable obj)
 {
     data = obj.GetDerEncoded();
 }