如何在不暴露密码的情况下连接到需要密码的数据库?

编程入门 行业动态 更新时间:2024-10-27 09:33:18
本文介绍了如何在不暴露密码的情况下连接到需要密码的数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在创建一个应用程序,我需要连接到一个数据库.数据库需要登录名/密码,因此应用程序可以执行选择和插入等操作.

I am creating an application and I need to connect to a database. The database requires login/password so the application can do operations like select and insert.

在应用程序中我需要使用登录名和密码连接到数据库,因此应用程序可以自由地对数据库执行一些任务.我的问题是:如何在不暴露密码的情况下存储和使用密码连接数据库?

In the application I need to connect to the database using login and password, so the application is free to do some tasks on the database. My question is: how do I store and use a password to connect to the database without exposing the password?

我不能简单地使用哈希或加密来存储密码,因为数据库必须识别密码(我认为大多数或所有数据库都必须以纯文本形式接收密码).

I can't simply use a hash or encryption to store the password because the database must recognize the password (I think most or all databases must receive password as plain text).

.

.

注意:连接是由应用程序建立的.无需人工输入即可进行连接.

Note: The connection is made by the application. No human input to do the connection.

(编辑)关于应用程序的更多信息:它是一个使用 servlets/jsp 的 Web 应用程序.数据库位于应用程序的同一台服务器上.应用程序的用户是默认用户,没有完全的管理权限,但它可以插入/删除行并执行大多数涉及查询和表中数据修改的事情.

(Edit)More info about the application: it is a web application using servlets/jsp. The database is on the same server of the application. The user for the application is a default user without complete admin powers, but it may insert/delete rows and do most things that involve queries and data modification in tables.

推荐答案

通常的做法是将用户名/密码外部化为 property/config 文件,在运行时读取(无论您是否使用本机 JDBC/JNDI/CDI/J2EE 数据源/等).

The usual way this is done is to externalize the username/password to a property/config file which is read at runtime (whether or not you use native JDBC/JNDI/CDI/J2EE datasource/etc).

系统管理员通过操作系统安全保护文件.

The file is protected via the O/S security by the sysadmins.

操作系统有比应用代码更好的保护工具.

The O/S has better tools for protection than app code.

更多推荐

如何在不暴露密码的情况下连接到需要密码的数据库?

本文发布于:2023-10-17 11:10:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1500717.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密码   连接到   情况下   数据库   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!