Return a BLOB value decrypted

Created on 29 January 2018, over 7 years ago
Updated 16 July 2025, 12 days ago

I am trying to return a BLOB value decrypted. Do I need to parse the value from a BLOB to a string value first before I use decryption? It works fine in my app but it just returns blank when I try to decrypt the value with the following (the value is stored as a BLOB in Drupal) e.g.
<030146f4 727616ca 1b15b228 0e50c476 7d955fd1 81f5ed27 fc25b137 68afe0f8 060287a9 e265acbb b62b926d 37710757 53810c67 8580e1b7 c842c742 88612885 97b60ec7 02d59710 04158af7 9cdd8917 8f35>

Here's a snippet of the code - the first name value is blank in the output. Any help would be great. Thanks.

$encryption_service = \Drupal::service('encryption');
    $elements = [];
    foreach ($items as $delta => $item) {
      $elements[$delta] = [
        '#type' => 'markup',
        '#markup' => $item->subject_id . ', ' . $item->subject_global_id
        . ', First name: ' . $encryption_service->decrypt($item->subject_fname) . ', ' . $item->subject_lname
        . ', ' . $item->subject_dob . ', ' . $item->subject_education
        . ', ' . $item->subject_occupation . ', ' . $item->subject_dominant_hand
        . ', ' . $item->subject_gender . ', ' . $item->subject_passcode
        . ', ' . $item->subject_photo . ', ' . $item->subject_device_id
      ];
    }
    return $elements;
  }
💬 Support request
Status

Closed: won't fix

Version

1.0

Component

Documentation

Created by

🇦🇺Australia scarer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024