@@ -91,25 +91,25 @@ static KMS_PROVIDERS: Lazy<KmsProviderList> = Lazy::new(|| {
9191 (
9292 KmsProvider :: Aws ,
9393 doc! {
94- "accessKeyId" : env( "AWS_ACCESS_KEY_ID " ) ,
95- "secretAccessKey" : env( "AWS_SECRET_ACCESS_KEY " ) ,
94+ "accessKeyId" : env( "FLE_AWS_KEY " ) ,
95+ "secretAccessKey" : env( "FLE_AWS_SECRET " ) ,
9696 } ,
9797 None ,
9898 ) ,
9999 (
100100 KmsProvider :: Azure ,
101101 doc! {
102- "tenantId" : env( "AZURE_TENANT_ID " ) ,
103- "clientId" : env( "AZURE_CLIENT_ID " ) ,
104- "clientSecret" : env( "AZURE_CLIENT_SECRET " ) ,
102+ "tenantId" : env( "FLE_AZURE_TENANTID " ) ,
103+ "clientId" : env( "FLE_AZURE_CLIENTID " ) ,
104+ "clientSecret" : env( "FLE_AZURE_CLIENTSECRET " ) ,
105105 } ,
106106 None ,
107107 ) ,
108108 (
109109 KmsProvider :: Gcp ,
110110 doc! {
111- "email" : env( "GCP_EMAIL " ) ,
112- "privateKey" : env( "GCP_PRIVATE_KEY " ) ,
111+ "email" : env( "FLE_GCP_EMAIL " ) ,
112+ "privateKey" : env( "FLE_GCP_PRIVATEKEY " ) ,
113113 } ,
114114 None ,
115115 ) ,
@@ -1641,6 +1641,10 @@ impl DeadlockExpectation {
16411641 }
16421642}
16431643
1644+ const KMS_EXPIRED : & str = "127.0.0.1:9000" ;
1645+ const KMS_WRONG_HOST : & str = "127.0.0.1:9001" ;
1646+ const KMS_CORRECT : & str = "127.0.0.1:9002" ;
1647+
16441648// Prose test 10. KMS TLS Tests
16451649#[ tokio:: test]
16461650async fn kms_tls ( ) -> Result < ( ) > {
@@ -1649,15 +1653,15 @@ async fn kms_tls() -> Result<()> {
16491653 }
16501654
16511655 // Invalid KMS Certificate
1652- let err = run_kms_tls_test ( "127.0.0.1:9000" ) . await . unwrap_err ( ) ;
1656+ let err = run_kms_tls_test ( KMS_EXPIRED ) . await . unwrap_err ( ) ;
16531657 assert ! (
16541658 err. to_string( ) . contains( "certificate verify failed" ) ,
16551659 "unexpected error: {}" ,
16561660 err
16571661 ) ;
16581662
16591663 // Invalid Hostname in KMS Certificate
1660- let err = run_kms_tls_test ( "127.0.0.1:9001" ) . await . unwrap_err ( ) ;
1664+ let err = run_kms_tls_test ( KMS_WRONG_HOST ) . await . unwrap_err ( ) ;
16611665 assert ! (
16621666 err. to_string( ) . contains( "certificate verify failed" ) ,
16631667 "unexpected error: {}" ,
@@ -1716,12 +1720,12 @@ async fn kms_tls_options() -> Result<()> {
17161720 . get_mut ( & KmsProvider :: Azure )
17171721 . unwrap ( )
17181722 . 0
1719- . insert ( "identityPlatformEndpoint" , "127.0.0.1:9002" ) ;
1723+ . insert ( "identityPlatformEndpoint" , KMS_CORRECT ) ;
17201724 base_providers
17211725 . get_mut ( & KmsProvider :: Gcp )
17221726 . unwrap ( )
17231727 . 0
1724- . insert ( "endpoint" , "127.0.0.1:9002" ) ;
1728+ . insert ( "endpoint" , KMS_CORRECT ) ;
17251729
17261730 let cert_dir = PathBuf :: from ( std:: env:: var ( "CSFLE_TLS_CERT_DIR" ) . unwrap ( ) ) ;
17271731 let ca_path = cert_dir. join ( "ca.pem" ) ;
@@ -1754,17 +1758,17 @@ async fn kms_tls_options() -> Result<()> {
17541758 . get_mut ( & KmsProvider :: Azure )
17551759 . unwrap ( )
17561760 . 0
1757- . insert ( "identityPlatformEndpoint" , "127.0.0.1:9000" ) ;
1761+ . insert ( "identityPlatformEndpoint" , KMS_EXPIRED ) ;
17581762 providers
17591763 . get_mut ( & KmsProvider :: Gcp )
17601764 . unwrap ( )
17611765 . 0
1762- . insert ( "endpoint" , "127.0.0.1:9000" ) ;
1766+ . insert ( "endpoint" , KMS_EXPIRED ) ;
17631767 providers
17641768 . get_mut ( & KmsProvider :: Kmip )
17651769 . unwrap ( )
17661770 . 0
1767- . insert ( "endpoint" , "127.0.0.1:9000" ) ;
1771+ . insert ( "endpoint" , KMS_EXPIRED ) ;
17681772
17691773 ClientEncryption :: new (
17701774 TestClient :: new ( ) . await . into_client ( ) ,
@@ -1782,17 +1786,17 @@ async fn kms_tls_options() -> Result<()> {
17821786 . get_mut ( & KmsProvider :: Azure )
17831787 . unwrap ( )
17841788 . 0
1785- . insert ( "identityPlatformEndpoint" , "127.0.0.1:9001" ) ;
1789+ . insert ( "identityPlatformEndpoint" , KMS_WRONG_HOST ) ;
17861790 providers
17871791 . get_mut ( & KmsProvider :: Gcp )
17881792 . unwrap ( )
17891793 . 0
1790- . insert ( "endpoint" , "127.0.0.1:9001" ) ;
1794+ . insert ( "endpoint" , KMS_WRONG_HOST ) ;
17911795 providers
17921796 . get_mut ( & KmsProvider :: Kmip )
17931797 . unwrap ( )
17941798 . 0
1795- . insert ( "endpoint" , "127.0.0.1:9001" ) ;
1799+ . insert ( "endpoint" , KMS_WRONG_HOST ) ;
17961800
17971801 ClientEncryption :: new (
17981802 TestClient :: new ( ) . await . into_client ( ) ,
@@ -1832,25 +1836,25 @@ async fn kms_tls_options() -> Result<()> {
18321836
18331837 provider_test (
18341838 & client_encryption_no_client_cert,
1835- aws_key ( "127.0.0.1:9002" ) ,
1839+ aws_key ( KMS_CORRECT ) ,
18361840 & [ "SSL routines" , "connection was forcibly closed" ] ,
18371841 )
18381842 . await ?;
18391843 provider_test (
18401844 & client_encryption_with_tls,
1841- aws_key ( "127.0.0.1:9002" ) ,
1845+ aws_key ( KMS_CORRECT ) ,
18421846 & [ "parse error" ] ,
18431847 )
18441848 . await ?;
18451849 provider_test (
18461850 & client_encryption_expired,
1847- aws_key ( "127.0.0.1:9000" ) ,
1851+ aws_key ( KMS_EXPIRED ) ,
18481852 & [ "certificate verify failed" ] ,
18491853 )
18501854 . await ?;
18511855 provider_test (
18521856 & client_encryption_invalid_hostname,
1853- aws_key ( "127.0.0.1:9001" ) ,
1857+ aws_key ( KMS_WRONG_HOST ) ,
18541858 & [ "certificate verify failed" ] ,
18551859 )
18561860 . await ?;
0 commit comments