@@ -1539,6 +1539,12 @@ def test_add_edit_key_kmip_no_ops(self):
15391539 args = base_args + ['--name' , 'key01' , '--kek-usage' , '--key-type' , 'kmip' ]
15401540 self .system_exit_run (self .command + args , None , start_server = False )
15411541 self .assertIn ('--kmip-operations' , self .str_output )
1542+ self .assertIn ('--kmip-key' , self .str_output )
1543+ self .assertIn ('--kmip-host' , self .str_output )
1544+ self .assertIn ('--kmip-port' , self .str_output )
1545+ self .assertIn ('--kmip-key-path' , self .str_output )
1546+ self .assertIn ('--kmip-cert-path' , self .str_output )
1547+ self .assertIn ('--kmip-server-verification' , self .str_output )
15421548
15431549 def test_add_edit_key_kmip_no_encrypt_method (self ):
15441550 self .server .set_args (self .server_args )
@@ -1547,7 +1553,8 @@ def test_add_edit_key_kmip_no_encrypt_method(self):
15471553 for base_args in [['--add-key' ], ['--edit-key' , '1' ]]:
15481554 args = base_args + ['--name' , 'key01' , '--kek-usage' , '--key-type' , 'kmip' , '--kmip-operations' , 'get' ,
15491555 '--kmip-key' , 'key' , '--kmip-host' , 'localhost' , '--kmip-port' , '1470' ,
1550- '--kmip-key-path' , '/key' , '--kmip-cert-path' , '/cert' ]
1556+ '--kmip-key-path' , '/key' , '--kmip-cert-path' , '/cert' , '--kmip-server-verification' ,
1557+ 'use-system-and-cb-ca' ]
15511558 self .system_exit_run (self .command + args , None , start_server = False )
15521559 self .assertIn (
15531560 'one of --encrypt-with-master-password, --encrypt-with-key must be specified' ,
@@ -1561,7 +1568,7 @@ def test_add_edit_key_kmip(self):
15611568 args = base_args + ['--name' , 'key01' , '--kek-usage' , '--key-type' , 'kmip' , '--kmip-operations' , 'get' ,
15621569 '--kmip-key' , 'key' , '--kmip-host' , 'localhost' , '--kmip-port' , '1470' ,
15631570 '--kmip-key-path' , '/key' , '--kmip-cert-path' , '/cert' ,
1564- '--encrypt-with-master-password' ]
1571+ '--encrypt-with-master-password' , '--kmip-server-verification' , 'use-system-and-cb-ca' ]
15651572 self .no_error_run (self .command + args , None , start_server = False )
15661573 expected = json .dumps ({
15671574 'usage' : ['KEK-encryption' ],
@@ -1575,6 +1582,88 @@ def test_add_edit_key_kmip(self):
15751582 'encryptionApproach' : 'useGet' ,
15761583 'keyPath' : '/key' ,
15771584 'certPath' : '/cert' ,
1585+ 'caSelection' : "useSysAndCbCa"
1586+ }
1587+ }, sort_keys = True )
1588+ self .rest_parameter_match ([expected ], length_match = False )
1589+
1590+ def test_add_edit_key_kmip_do_not_verify (self ):
1591+ self .server .set_args (self .server_args )
1592+ self .server .run ()
1593+
1594+ for base_args in [['--add-key' ], ['--edit-key' , '1' ]]:
1595+ args = base_args + ['--name' , 'key01' , '--kek-usage' , '--key-type' , 'kmip' , '--kmip-operations' , 'get' ,
1596+ '--kmip-key' , 'key' , '--kmip-host' , 'localhost' , '--kmip-port' , '1470' ,
1597+ '--kmip-key-path' , '/key' , '--kmip-cert-path' , '/cert' ,
1598+ '--encrypt-with-master-password' , '--kmip-server-verification' , 'do-not-verify' ]
1599+ self .no_error_run (self .command + args , None , start_server = False )
1600+ expected = json .dumps ({
1601+ 'usage' : ['KEK-encryption' ],
1602+ 'name' : 'key01' ,
1603+ 'type' : 'kmip-aes-key-256' ,
1604+ 'data' : {
1605+ 'encryptWith' : 'nodeSecretManager' ,
1606+ 'activeKey' : {'kmipId' : 'key' },
1607+ 'host' : 'localhost' ,
1608+ 'port' : 1470 ,
1609+ 'encryptionApproach' : 'useGet' ,
1610+ 'keyPath' : '/key' ,
1611+ 'certPath' : '/cert' ,
1612+ 'caSelection' : "skipServerCertVerification"
1613+ }
1614+ }, sort_keys = True )
1615+ self .rest_parameter_match ([expected ], length_match = False )
1616+
1617+ def test_add_edit_key_kmip_use_system_ca (self ):
1618+ self .server .set_args (self .server_args )
1619+ self .server .run ()
1620+
1621+ for base_args in [['--add-key' ], ['--edit-key' , '1' ]]:
1622+ args = base_args + ['--name' , 'key01' , '--kek-usage' , '--key-type' , 'kmip' , '--kmip-operations' , 'get' ,
1623+ '--kmip-key' , 'key' , '--kmip-host' , 'localhost' , '--kmip-port' , '1470' ,
1624+ '--kmip-key-path' , '/key' , '--kmip-cert-path' , '/cert' ,
1625+ '--encrypt-with-master-password' , '--kmip-server-verification' , 'use-system-ca' ]
1626+ self .no_error_run (self .command + args , None , start_server = False )
1627+ expected = json .dumps ({
1628+ 'usage' : ['KEK-encryption' ],
1629+ 'name' : 'key01' ,
1630+ 'type' : 'kmip-aes-key-256' ,
1631+ 'data' : {
1632+ 'encryptWith' : 'nodeSecretManager' ,
1633+ 'activeKey' : {'kmipId' : 'key' },
1634+ 'host' : 'localhost' ,
1635+ 'port' : 1470 ,
1636+ 'encryptionApproach' : 'useGet' ,
1637+ 'keyPath' : '/key' ,
1638+ 'certPath' : '/cert' ,
1639+ 'caSelection' : "useSysCa"
1640+ }
1641+ }, sort_keys = True )
1642+ self .rest_parameter_match ([expected ], length_match = False )
1643+
1644+ def test_add_edit_key_kmip_use_cb_ca (self ):
1645+ self .server .set_args (self .server_args )
1646+ self .server .run ()
1647+
1648+ for base_args in [['--add-key' ], ['--edit-key' , '1' ]]:
1649+ args = base_args + ['--name' , 'key01' , '--kek-usage' , '--key-type' , 'kmip' , '--kmip-operations' , 'get' ,
1650+ '--kmip-key' , 'key' , '--kmip-host' , 'localhost' , '--kmip-port' , '1470' ,
1651+ '--kmip-key-path' , '/key' , '--kmip-cert-path' , '/cert' ,
1652+ '--encrypt-with-master-password' , '--kmip-server-verification' , 'use-cb-ca' ]
1653+ self .no_error_run (self .command + args , None , start_server = False )
1654+ expected = json .dumps ({
1655+ 'usage' : ['KEK-encryption' ],
1656+ 'name' : 'key01' ,
1657+ 'type' : 'kmip-aes-key-256' ,
1658+ 'data' : {
1659+ 'encryptWith' : 'nodeSecretManager' ,
1660+ 'activeKey' : {'kmipId' : 'key' },
1661+ 'host' : 'localhost' ,
1662+ 'port' : 1470 ,
1663+ 'encryptionApproach' : 'useGet' ,
1664+ 'keyPath' : '/key' ,
1665+ 'certPath' : '/cert' ,
1666+ 'caSelection' : "useCbCa"
15781667 }
15791668 }, sort_keys = True )
15801669 self .rest_parameter_match ([expected ], length_match = False )
0 commit comments