Example #1
0
 internal HashedHostKey(KnownHosts mykh, string host, int type, byte[] key) :
     base(host, type, key)
 {
     this.mykh = mykh;
     if (this.host.StartsWith(HASH_MAGIC) &&
         this.host.Substring(HASH_MAGIC.Length).IndexOf(HASH_DELIM) > 0)
     {
         string data  = this.host.Substring(HASH_MAGIC.Length);
         string _salt = data.Substring(0, data.IndexOf(HASH_DELIM));
         string _hash = data.Substring(data.IndexOf(HASH_DELIM) + 1);
         salt = Util.fromBase64(_salt.getBytes(), 0, _salt.Length);
         hash = Util.fromBase64(_hash.getBytes(), 0, _hash.Length);
         if (salt.Length != 20 ||  // block size of hmac-sha1
             hash.Length != 20)
         {
             salt = null;
             hash = null;
             return;
         }
         hashed = true;
     }
 }
Example #2
0
 internal HashedHostKey(KnownHosts mykh, string host, int type, byte[] key)
     : base(host, type, key)
 {
     this.mykh = mykh;
     if (this.host.StartsWith(HASH_MAGIC) &&
        this.host.Substring(HASH_MAGIC.Length).IndexOf(HASH_DELIM) > 0)
     {
         string data = this.host.Substring(HASH_MAGIC.Length);
         string _salt = data.Substring(0, data.IndexOf(HASH_DELIM));
         string _hash = data.Substring(data.IndexOf(HASH_DELIM) + 1);
         salt = Util.fromBase64(_salt.getBytes(), 0, _salt.Length);
         hash = Util.fromBase64(_hash.getBytes(), 0, _hash.Length);
         if (salt.Length != 20 ||  // block size of hmac-sha1
            hash.Length != 20)
         {
             salt = null;
             hash = null;
             return;
         }
         hashed = true;
     }
 }
Example #3
0
 internal HashedHostKey(KnownHosts mykh, string host, byte[] key)
     :
     this(mykh, host, GUESS, key)
 {
 }
Example #4
0
 internal HashedHostKey(KnownHosts mykh, string host, byte[] key)
     : this(mykh, host, GUESS, key)
 {
 }