diff --git a/drd.install b/drd.install
index e2ee285d38df5dce076483a7d98d7b91852e8827..e0a1271faabd2f442a4d3e950ef5e141ca820e8b 100644
--- a/drd.install
+++ b/drd.install
@@ -177,3 +177,36 @@ function drd_update_8008(): void {
       ->execute();
   }
 }
+
+/**
+ * Update crypt class names stored as keys in the cryptsetting field.
+ */
+function drd_update_8009(): void {
+  $domains = \Drupal::entityTypeManager()->getStorage('drd_domain')->loadMultiple();
+  $encryptService = \Drupal::service('drd.encrypt');
+  $methods = [
+    'MCrypt' => 'Mcrypt',
+    'OpenSSL' => 'OpenSsl',
+    'TLS' => 'Tls',
+  ];
+
+  /** @var \Drupal\drd\Entity\DomainInterface $domain */
+  foreach ($domains as $domain) {
+    foreach ($methods as $old => $new) {
+      $cryptSetting = $domain->getCryptSetting($old);
+
+      if (count($cryptSetting) > 0) {
+        // Values in $cryptSetting were decrypted above.
+        $encryptService->encrypt($cryptSetting);
+
+        // Need to add method "key" before saving the new cryptsetting array.
+        $newCryptSetting = [
+          $new => $cryptSetting,
+        ];
+
+        $domain->set('cryptsetting', $newCryptSetting);
+        $domain->save();
+      }
+    }
+  }
+}