forked from datastax/php-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssl_encryption.feature
107 lines (98 loc) · 3.26 KB
/
ssl_encryption.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
@SSL
Feature: SSL encryption
PHP Driver supports SSL encryption.
Scenario: Connecting without SSL encryption
Given a running cassandra cluster with SSL encryption
And the following example:
"""php
<?php
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->build();
try {
$session = $cluster->connect();
} catch (Cassandra\Exception\RuntimeException $e) {
echo "Connection failure\n";
}
"""
When it is executed
Then its output should contain:
"""
Connection failure
"""
Scenario: Connecting with basic SSL encryption
Given a running cassandra cluster with SSL encryption
And the following example:
"""php
<?php
$ssl = Cassandra::ssl()
->withVerifyFlags(Cassandra::VERIFY_NONE)
->build();
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->withSSL($ssl)
->build();
try {
$session = $cluster->connect();
echo "Connection success\n";
} catch (Cassandra\Exception\RuntimeException $e) {
echo "Connection failure\n";
}
"""
When it is executed
Then its output should contain:
"""
Connection success
"""
Scenario: Connecting with certificate verification
Given a running cassandra cluster with SSL encryption
And the following example:
"""php
<?php
$ssl = Cassandra::ssl()
->withVerifyFlags(Cassandra::VERIFY_PEER_CERT)
->withTrustedCerts(getenv('SERVER_CERT'))
->build();
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->withSSL($ssl)
->build();
try {
$session = $cluster->connect();
echo "Connection success\n";
} catch (Cassandra\Exception\RuntimeException $e) {
echo "Connection failure\n";
}
"""
When it is executed with trusted cert in the env
Then its output should contain:
"""
Connection success
"""
Scenario: Connecting with client certificate verification
Given a running cassandra cluster with client certificate verification
And the following example:
"""php
<?php
$ssl = Cassandra::ssl()
->withVerifyFlags(Cassandra::VERIFY_PEER_CERT)
->withTrustedCerts(getenv('SERVER_CERT'))
->withClientCert(getenv('CLIENT_CERT'))
->withPrivateKey(getenv('PRIVATE_KEY'), getenv('PASSPHRASE'))
->build();
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->withSSL($ssl)
->build();
try {
$session = $cluster->connect();
echo "Connection success\n";
} catch (Cassandra\Exception\RuntimeException $e) {
echo "Connection failure\n";
}
"""
When it is executed with trusted and client certs, private key and passphrase in the env
Then its output should contain:
"""
Connection success
"""