---
updatedAt: 2025-05-12T20:21:43.000Z
agentTools:
  projectIndex: https://docs.etherfax.net/llms.txt
---

# SENxContext Class

A security context class that provides encryption and decryption services.

```csharp
public class SENxContext
```

**CONSTRUCTORS**

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th style={{ textAlign: "left" }}>

      </th>

      <th style={{ textAlign: "left" }}>
        Name
      </th>

      <th style={{ textAlign: "left" }}>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td style={{ textAlign: "left" }}>
        :small_blue_diamond:
      </td>

      <td style={{ textAlign: "left" }}>
        SENxContext(CryptoAlgorithm *crypto*, HashAlgorithm *hash*)
      </td>

      <td style={{ textAlign: "left" }}>
        Initializes a SENxContext instance using the specified CryptoAlgorithm (cipher) and HashAlgorithm.
      </td>
    </tr>
  </tbody>
</Table>

**PROPERTIES**

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>

      </th>

      <th>
        Name
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        :fa-file-text-o:
      </td>

      <td>
        Error
      </td>

      <td>
        Contains the result/error of the last operation.
      </td>
    </tr>

    <tr>
      <td>
        :fa-file-text-o:
      </td>

      <td>
        ErrorMessage
      </td>

      <td>
        Contains the error message of the last operation.
      </td>
    </tr>

    <tr>
      <td>
        :fa-file-text-o:
      </td>

      <td>
        HasPrivateKey
      </td>

      <td>
        A bool indicating whether a private key has been loaded.
      </td>
    </tr>

    <tr>
      <td>
        :fa-file-text-o:
      </td>

      <td>
        HasPublicKey
      </td>

      <td>
        A bool indicating whether a public key has been loaded.
      </td>
    </tr>

    <tr>
      <td>
        :fa-file-text-o:
      </td>

      <td>
        KeySize
      </td>

      <td>
        An integer representing the key size (in bits) of the currently loaded key.
      </td>
    </tr>
  </tbody>
</Table>

**METHODS**

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th>

      </th>

      <th>
        Name
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        :small_blue_diamond:
      </td>

      <td>
        FromCryptogram(byte\[] *cryptogram*)
      </td>

      <td>
        Creates a SENxContext instance from the Cryptogram byte array parameter.
      </td>
    </tr>

    <tr>
      <td>
        :small_blue_diamond:
      </td>

      <td>
        Decrypt(byte\[] *cryptogram*)
      </td>

      <td>
        Decrypts the array of bytes representing the cryptogram into its original contents.
      </td>
    </tr>

    <tr>
      <td>
        :small_blue_diamond:
      </td>

      <td>
        Dispose()
      </td>

      <td>
        Disposes the SENxContext instance. This method also implicitly calls the FreeContext() method.
      </td>
    </tr>

    <tr>
      <td>
        :small_blue_diamond:
      </td>

      <td>
        Encrypt(byte\[] *clearText*)
      </td>

      <td>
        Encrypts the array of bytes into a cryptogram that may be transmitted using the EtherFaxClient *SendFax()* method.
      </td>
    </tr>

    <tr>
      <td>
        :small_blue_diamond:
      </td>

      <td>
        FreeContext()
      </td>

      <td>
        Releases all resources allocated by this instance.
      </td>
    </tr>

    <tr>
      <td>
        :small_blue_diamond:
      </td>

      <td>
        IsCryptogram(byte\[] *cryptogram*)
      </td>

      <td>
        Returns a bool if the byte\[] array contains a valid cryptogram.
      </td>
    </tr>

    <tr>
      <td>
        :small_blue_diamond:
      </td>

      <td>
        LoadKeyFromBuffer(byte\[] *keyBuffer*)
      </td>

      <td>
        Loads the public or private key (PEM) from a byte\[] buffer.
      </td>
    </tr>

    <tr>
      <td>
        :small_blue_diamond:
      </td>

      <td>
        LoadKeyFromFile(string *keyFIle*)
      </td>

      <td>
        Loads the public or private key (PEM) from a file.
      </td>
    </tr>
  </tbody>
</Table>