Tamir.SharpSsh.jsch.KeyPairDSA.parse C# (CSharp) Метод

parse() приватный Метод

private parse ( byte plain ) : bool
plain byte
Результат bool
		internal override bool parse(byte[] plain)
		{
			try
			{

				if(vendor==VENDOR_FSECURE)
				{
					if(plain[0]!=0x30)
					{              // FSecure
						Buffer buf=new Buffer(plain);
						buf.ReadInt();
						P_array=buf.ReadMPIntBits();
						G_array=buf.ReadMPIntBits();
						Q_array=buf.ReadMPIntBits();
						pub_array=buf.ReadMPIntBits();
						prv_array=buf.ReadMPIntBits();
						return true;
					}
					return false;
				}

				int index=0;
				int Length=0;

				if(plain[index]!=0x30)return false;
				index++; // SEQUENCE
				Length=plain[index++]&0xff;
				if((Length&0x80)!=0)
				{
					int foo=Length&0x7f; Length=0;
					while(foo-->0){ Length=(Length<<8)+(plain[index++]&0xff); }
				}

				if(plain[index]!=0x02)return false;
				index++; // INTEGER
				Length=plain[index++]&0xff;
				if((Length&0x80)!=0)
				{
					int foo=Length&0x7f; Length=0;
					while(foo-->0){ Length=(Length<<8)+(plain[index++]&0xff); }
				}
				index+=Length;

				index++;
				Length=plain[index++]&0xff;
				if((Length&0x80)!=0)
				{
					int foo=Length&0x7f; Length=0;
					while(foo-->0){ Length=(Length<<8)+(plain[index++]&0xff); }
				}
				P_array=new byte[Length];
				Array.Copy(plain, index, P_array, 0, Length);
				index+=Length;

				index++;
				Length=plain[index++]&0xff;
				if((Length&0x80)!=0)
				{
					int foo=Length&0x7f; Length=0;
					while(foo-->0){ Length=(Length<<8)+(plain[index++]&0xff); }
				}
				Q_array=new byte[Length];
				Array.Copy(plain, index, Q_array, 0, Length);
				index+=Length;

				index++;
				Length=plain[index++]&0xff;
				if((Length&0x80)!=0)
				{
					int foo=Length&0x7f; Length=0;
					while(foo-->0){ Length=(Length<<8)+(plain[index++]&0xff); }
				}
				G_array=new byte[Length];
				Array.Copy(plain, index, G_array, 0, Length);
				index+=Length;

				index++;
				Length=plain[index++]&0xff;
				if((Length&0x80)!=0)
				{
					int foo=Length&0x7f; Length=0;
					while(foo-->0){ Length=(Length<<8)+(plain[index++]&0xff); }
				}
				pub_array=new byte[Length];
				Array.Copy(plain, index, pub_array, 0, Length);
				index+=Length;

				index++;
				Length=plain[index++]&0xff;
				if((Length&0x80)!=0)
				{
					int foo=Length&0x7f; Length=0;
					while(foo-->0){ Length=(Length<<8)+(plain[index++]&0xff); }
				}
				prv_array=new byte[Length];
				Array.Copy(plain, index, prv_array, 0, Length);
				index+=Length;
			}
			catch//(Exception e)
			{
				//System.out.println(e);
				//e.printStackTrace();
				return false;
			}
			return true;
		}