@@ -908,19 +908,6 @@ void CreateDatabaseWithEncryptionKey(
908908 std::cout << " Database " << db->name () << " created" ;
909909 std::cout << " using encryption key " << encryption_key.FullName ();
910910 std::cout << " .\n " ;
911-
912- // Verify the encryption key matches the value used during creation.
913- auto get_database = client.GetDatabase (database);
914- if (!get_database) throw std::runtime_error (get_database.status ().message ());
915- if (!get_database->has_encryption_config ()) {
916- throw std::runtime_error (" Encryption Config is not present" );
917- }
918- auto const & kms_key_name = get_database->encryption_config ().kms_key_name ();
919- if (kms_key_name != encryption_key.FullName ()) {
920- throw std::runtime_error (" Encryption key name mismatch: expected " +
921- encryption_key.FullName () + " actual " +
922- kms_key_name);
923- }
924911}
925912// [END spanner_create_database_with_encryption_key]
926913// ! [create-database-with-encryption-key]
@@ -965,20 +952,6 @@ void CreateBackupWithEncryptionKey(
965952 << " was created at "
966953 << google::cloud::spanner::MakeTimestamp (backup->create_time ()).value ()
967954 << " using encryption key " << encryption_key.FullName () << " .\n " ;
968-
969- // Verify the encryption key matches the value used during backup.
970- auto get_backup = client.GetBackup (
971- google::cloud::spanner::Backup (database.instance (), backup_id));
972- if (!get_backup) throw std::runtime_error (get_backup.status ().message ());
973- if (!get_backup->has_encryption_info ()) {
974- throw std::runtime_error (" Encryption Info is not present" );
975- }
976- auto const & kms_key_version = get_backup->encryption_info ().kms_key_version ();
977- if (kms_key_version.rfind (encryption_key.FullName () + " /" , 0 ) != 0 ) {
978- throw std::runtime_error (" Encryption key name mismatch: expected " +
979- encryption_key.FullName () + " actual " +
980- kms_key_version);
981- }
982955}
983956// [END spanner_create_backup_with_encryption_key]
984957// ! [create-backup-with-encryption-key]
@@ -1033,19 +1006,6 @@ void RestoreDatabaseWithEncryptionKey(
10331006 std::cout << " from backup " << backup.FullName ();
10341007 std::cout << " using encryption key " << encryption_key.FullName ();
10351008 std::cout << " .\n " ;
1036-
1037- // Verify the encryption key matches the value used during restoration.
1038- auto get_database = client.GetDatabase (database);
1039- if (!get_database) throw std::runtime_error (get_database.status ().message ());
1040- if (!get_database->has_encryption_config ()) {
1041- throw std::runtime_error (" Encryption Config is not present" );
1042- }
1043- auto const & kms_key_name = get_database->encryption_config ().kms_key_name ();
1044- if (kms_key_name != encryption_key.FullName ()) {
1045- throw std::runtime_error (" Encryption key name mismatch: expected " +
1046- encryption_key.FullName () + " actual " +
1047- kms_key_name);
1048- }
10491009}
10501010// [END spanner_restore_backup_with_encryption_key]
10511011// ! [restore-database-with-encryption-key]
0 commit comments