Summary description for KimProfile.
コード例 #1
0
ファイル: OpUser.cs プロジェクト: nandub/DeOps
        public static void CreateNew(string path, string opName, string userName, string password, AccessType access, byte[] opKey, bool globalIM)
        {
            OpUser user = new OpUser(path, password);

            user.Settings.Operation = opName;
            user.Settings.UserName  = userName;
            user.Settings.KeyPair   = new RSACryptoServiceProvider(1024);
            user.Settings.FileKey   = Utilities.GenerateKey(new RNGCryptoServiceProvider(), 256);
            user.Settings.OpAccess  = access;
            user.Settings.Security  = SecurityLevel.Medium;
            user.Settings.GlobalIM  = globalIM;

            // joining/creating public
            if (access == AccessType.Public)
            {
                // 256 bit rijn

                SHA256Managed sha256 = new SHA256Managed();
                user.Settings.OpKey    = sha256.ComputeHash(UTF8Encoding.UTF8.GetBytes(opName.ToLowerInvariant()));
                user.Settings.Security = SecurityLevel.Low;
            }

            // invite to private/secret
            else if (opKey != null)
            {
                user.Settings.OpKey = opKey;
            }

            // creating private/secret
            else if (globalIM)
            {
                user.Settings.OpKey = DhtNetwork.GlobalIMKey;
            }

            else
            {
                user.Settings.OpKey = Utilities.GenerateKey(new RNGCryptoServiceProvider(), 256);
            }

            user.Save();

            // throws exception on failure
        }
コード例 #2
0
ファイル: OpUser.cs プロジェクト: swax/DeOps
        public static void CreateNew(string path, string opName, string userName, string password, AccessType access, byte[] opKey, bool globalIM)
        {
            OpUser user = new OpUser(path, password);
            user.Settings.Operation = opName;
            user.Settings.UserName = userName;
            user.Settings.KeyPair = new RSACryptoServiceProvider(1024);
            user.Settings.FileKey = Utilities.GenerateKey(new RNGCryptoServiceProvider(), 256);
            user.Settings.OpAccess = access;
            user.Settings.Security = SecurityLevel.Medium;
            user.Settings.GlobalIM = globalIM;

            // joining/creating public
            if (access == AccessType.Public)
            {
                // 256 bit rijn

                SHA256Managed sha256 = new SHA256Managed();
                user.Settings.OpKey = sha256.ComputeHash(UTF8Encoding.UTF8.GetBytes(opName.ToLowerInvariant()));
                user.Settings.Security = SecurityLevel.Low;
            }

            // invite to private/secret
            else if (opKey != null)
                user.Settings.OpKey = opKey;

            // creating private/secret
            else if (globalIM)
                user.Settings.OpKey = DhtNetwork.GlobalIMKey;

            else
                user.Settings.OpKey = Utilities.GenerateKey(new RNGCryptoServiceProvider(), 256);

            user.Save();

            // throws exception on failure
        }