使用 public 密钥为 Amazon Aurora 数据库创建加密连接

Creating Encrypted connection for Amazon Aurora DB with public key

我正在使用 Maria JDBC 驱动程序来创建与 Amazon Aurora 数据库的连接 我想创建一个安全连接,所以我阅读了 here

To connect to a DB cluster with SSL using the MySQL utility

Download the public key for the Amazon RDS signing certificate from https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem. Note that this will download a file named rds-combined-ca-bundle.pem.

第一个问题: 它究竟是如何安全的 - 任何人都可以从 Amazon AWS?

下载这个 pem 文件

我做了一些研究 我应该如何使用 public 密钥连接到 Aurora DB 我找到了这两个链接 First,

所以我的代码很简单:

Class.forName("org.mariadb.jdbc.Driver");

Properties prop = new Properties();

prop.setProperty("javax.net.ssl.trustStore","C:\temp\rds-combined-ca-bundle.pem");
prop.setProperty("user",jdbcDetails.username);
prop.setProperty("password",jdbcDetails.getSensitiveData());

    java.sql.Connection conne = DriverManager.getConnection(jdbcDetails.connectionString, prop);
    try (Statement stmt1 = conne.createStatement()) {
        // Execute all but the rest
        ResultSet rs = stmt1.executeQuery("Select 98765 from dual limit 2");
        while(rs.next()) {

            rs.getLong(1);
        }
    }
    conne.close();

第二个问题: public key file 与加密有什么关系?

以上信息与 Oracle Java information 不一致,即:

If the client wants to authenticate the server, then the client's trust store must contain the server's certificate

第三个问题:据我了解,如果客户端信任服务器,则不需要他使用此文件

第四个问题:我正在检查与 Wireshark 的连接创建 无论有没有这个 public key file 我都能够创建连接并且 Wireshark 中的两个案例都出现了加密

看起来像这样的东西:

Encrypted Application Data:
eb:62:45:fb:10:50:f7:8c............:b9:0a:52:e7:97:1d:34

基于 我了解 public 密钥用法:

首先, Amazon AWS Azure 文档似乎有点误导——它只与名为 MySQL utility

的特定工具的连接有关

第一、二、三题的答案:

"Java can definitely establish an SSL connection without a client validating the certificate chain of the server."

进行密钥交换以确保它所连接的服务器确实是它所期望的服务器(即非可疑服务器) 这意味着它仍然是相同的 SSL 连接,但是使用 verifyServerCertificate=false 它不会验证它是否是预期的服务器

回答第四个问题: Currect,代码在 Java - 并传递 SSL 参数使其加密。

所以使用这些参数可以满足要求 ?trustServerCertificate=true&useSSL=true&requireSSL=true&verifyServerCertificate=false