diff --git a/catalogue/OracleCatalogue.cpp b/catalogue/OracleCatalogue.cpp
index 03c6e4bf5185f6e0e08d66c85deef9558efff3d5..0ea88011d8ed974e4d63c1b1287fde9c5458be74 100644
--- a/catalogue/OracleCatalogue.cpp
+++ b/catalogue/OracleCatalogue.cpp
@@ -224,7 +224,7 @@ common::dataStructures::Tape OracleCatalogue::selectTapeForUpdate(rdbms::Conn &c
     tape.vid = rset->columnText("VID");
     tape.logicalLibraryName = rset->columnText("LOGICAL_LIBRARY_NAME");
     tape.tapePoolName = rset->columnText("TAPE_POOL_NAME");
-    tape.encryptionKey = rset->columnText("ENCRYPTION_KEY");
+    tape.encryptionKey = rset->columnOptionalText("ENCRYPTION_KEY");
     tape.capacityInBytes = rset->columnUint64("CAPACITY_IN_BYTES");
     tape.dataOnTapeInBytes = rset->columnUint64("DATA_IN_BYTES");
     tape.lastFSeq = rset->columnUint64("LAST_FSEQ");
diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp
index 58b4c9fc4a56fc5b158e3d02e80ef27c5a3aab4f..5e3732724b098ed9bac1f7699964a34f4672df97 100644
--- a/catalogue/RdbmsCatalogue.cpp
+++ b/catalogue/RdbmsCatalogue.cpp
@@ -1305,7 +1305,7 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(const TapeSearc
       tape.vid = rset->columnText("VID");
       tape.logicalLibraryName = rset->columnText("LOGICAL_LIBRARY_NAME");
       tape.tapePoolName = rset->columnText("TAPE_POOL_NAME");
-      tape.encryptionKey = rset->columnText("ENCRYPTION_KEY");
+      tape.encryptionKey = rset->columnOptionalText("ENCRYPTION_KEY");
       tape.capacityInBytes = rset->columnUint64("CAPACITY_IN_BYTES");
       tape.dataOnTapeInBytes = rset->columnUint64("DATA_IN_BYTES");
       tape.lastFSeq = rset->columnUint64("LAST_FSEQ");
@@ -1405,7 +1405,7 @@ common::dataStructures::VidToTapeMap RdbmsCatalogue::getTapesByVid(const std::se
       tape.vid = rset->columnText("VID");
       tape.logicalLibraryName = rset->columnText("LOGICAL_LIBRARY_NAME");
       tape.tapePoolName = rset->columnText("TAPE_POOL_NAME");
-      tape.encryptionKey = rset->columnText("ENCRYPTION_KEY");
+      tape.encryptionKey = rset->columnOptionalText("ENCRYPTION_KEY");
       tape.capacityInBytes = rset->columnUint64("CAPACITY_IN_BYTES");
       tape.dataOnTapeInBytes = rset->columnUint64("DATA_IN_BYTES");
       tape.lastFSeq = rset->columnUint64("LAST_FSEQ");
diff --git a/catalogue/SqliteCatalogue.cpp b/catalogue/SqliteCatalogue.cpp
index e9b9b3373e5b46d01ca7de84c7e297abc8f623c0..059e102d224a594ab4a63e64343418a11c53e43a 100644
--- a/catalogue/SqliteCatalogue.cpp
+++ b/catalogue/SqliteCatalogue.cpp
@@ -238,7 +238,7 @@ common::dataStructures::Tape SqliteCatalogue::selectTapeForUpdate(rdbms::Conn &c
     tape.vid = rset->columnText("VID");
     tape.logicalLibraryName = rset->columnText("LOGICAL_LIBRARY_NAME");
     tape.tapePoolName = rset->columnText("TAPE_POOL_NAME");
-    tape.encryptionKey = rset->columnText("ENCRYPTION_KEY");
+    tape.encryptionKey = rset->columnOptionalText("ENCRYPTION_KEY");
     tape.capacityInBytes = rset->columnUint64("CAPACITY_IN_BYTES");
     tape.dataOnTapeInBytes = rset->columnUint64("DATA_IN_BYTES");
     tape.lastFSeq = rset->columnUint64("LAST_FSEQ");
diff --git a/common/dataStructures/Tape.cpp b/common/dataStructures/Tape.cpp
index 02df15d58231d7b199d020c202f02479e7f8d719..97b66ebc3af178a1a3426986771ea1f91d3ba437 100644
--- a/common/dataStructures/Tape.cpp
+++ b/common/dataStructures/Tape.cpp
@@ -71,7 +71,7 @@ std::ostream &operator<<(std::ostream &os, const Tape &obj) {
      << " tapePoolName=" << obj.tapePoolName
      << " capacityInBytes=" << obj.capacityInBytes
      << " dataOnTapeInBytes=" << obj.dataOnTapeInBytes
-     << " encryptionKey=" << obj.encryptionKey
+     << " encryptionKey=" << ((bool)obj.encryptionKey ? obj.encryptionKey.value() : "null")
      << " lbp=" << obj.lbp
      << " full=" << obj.full
      << " disabled=" << obj.disabled
diff --git a/common/dataStructures/Tape.hpp b/common/dataStructures/Tape.hpp
index fe034bbc054b3a1267973eb48fd349b0ceed938c..95e9e245bc9cac835c7b4f02227114cd9389611f 100644
--- a/common/dataStructures/Tape.hpp
+++ b/common/dataStructures/Tape.hpp
@@ -48,7 +48,7 @@ struct Tape {
   std::string tapePoolName;
   uint64_t capacityInBytes;
   uint64_t dataOnTapeInBytes;
-  std::string encryptionKey;
+  optional<std::string> encryptionKey;
   bool lbp;
   bool full;
   bool disabled;
diff --git a/xroot_plugins/XrdCtaFile.cpp b/xroot_plugins/XrdCtaFile.cpp
index 3df12e4da592ae1aa2241040e794da2ac357142f..b8f27f7311e7315ad4b6d48f3e2941d09e5bd4f9 100644
--- a/xroot_plugins/XrdCtaFile.cpp
+++ b/xroot_plugins/XrdCtaFile.cpp
@@ -1034,7 +1034,7 @@ void XrdCtaFile::xCom_tape() {
         currentRow.push_back(it->vid);
         currentRow.push_back(it->logicalLibraryName);
         currentRow.push_back(it->tapePoolName);
-        currentRow.push_back(it->encryptionKey);
+        currentRow.push_back((bool)it->encryptionKey ? it->encryptionKey.value() : "null");
         currentRow.push_back(std::to_string((unsigned long long)it->capacityInBytes));
         currentRow.push_back(std::to_string((unsigned long long)it->dataOnTapeInBytes));
         currentRow.push_back(std::to_string((unsigned long long)it->lastFSeq));