Exemple #1
0
        private DataProtectionException GetException(Exception ex)
        {
            var message = $@"Error while unprotecting DPAPI-protected user data. {
                (Scope == DataProtectionScope.CurrentUser
                    ? "The scope is set to 'CurrentUser' - are you sure that the user that is running this application is the same user that protected the user data?"
                    : "The scope is set to 'LocalMachine' - are you sure that the machine that is running this application is the same machine that was used to protect the user data?")}";

            var exception = new DataProtectionException(message, ex);

            return(exception);
        }
        private DataProtectionException GetException(Exception ex)
        {
            var message = $@"Error while unprotecting DPAPI-protected user data. {
                (Scope == DataProtectionScope.CurrentUser
                    ? "The scope is set to 'CurrentUser' - are you sure that the user that is running this application is the same user that protected the user data?"
                    : "The scope is set to 'LocalMachine' - are you sure that the machine that is running this application is the same machine that was used to protect the user data?")}";

            var exception = new DataProtectionException(message, ex);
            return exception;
        }