Class Crypter
Contains methods used to crypt/decrypt a data.
Inheritance
Namespace: FastReport.Utils
Assembly: FastReport.dll
Syntax
public static class Crypter
Properties
DefaultPassword
Sets the password that is used to crypt connection strings stored in a report.
Declaration
public static string DefaultPassword { set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
See the ConnectionString property for more details.
Methods
ComputeHash(Byte[])
Computes hash of specified array.
Declaration
public static string ComputeHash(byte[] input)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | input | Initial array |
Returns
| Type | Description |
|---|---|
| System.String |
ComputeHash(Stream)
Computes hash of specified stream. Initial position in stream will be saved.
Declaration
public static string ComputeHash(Stream input)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | input | Initial stream |
Returns
| Type | Description |
|---|---|
| System.String |
ComputeHash(String)
Computes hash of specified array.
Declaration
public static string ComputeHash(string input)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | input | Initial array |
Returns
| Type | Description |
|---|---|
| System.String |
Decrypt(Stream, String)
Decrypts a stream using specified password.
Declaration
public static Stream Decrypt(Stream source, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | source | Stream that contains crypted data. |
| System.String | password | The password. |
Returns
| Type | Description |
|---|---|
| System.IO.Stream | The stream that contains decrypted data. |
Remarks
You should read from the stream that this method returns.
DecryptString(String)
Decrypts the string using the default password.
Declaration
public static string DecryptString(string data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | data | String to decrypt. |
Returns
| Type | Description |
|---|---|
| System.String | The decrypted string. |
Remarks
The password used to decrypt a string can be set via DefaultPassword property. You also may use the DecryptString(String, String) method if you want to specify another password.
DecryptString(String, String)
Decrypts the string using specified password.
Declaration
public static string DecryptString(string data, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | data | String to decrypt. |
| System.String | password | The password. |
Returns
| Type | Description |
|---|---|
| System.String | The decrypted string. |
Encrypt(Stream, String)
Crypts a stream using specified password.
Declaration
public static Stream Encrypt(Stream dest, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | dest | The destination stream that will receive the crypted data. |
| System.String | password | The password. |
Returns
| Type | Description |
|---|---|
| System.IO.Stream | The stream that you need to write to. |
Remarks
Pass the stream you need to write to, to the dest parameter. Write your data to the stream that this method returns. When you close this stream, the dest stream will be closed too and contains the crypted data.
EncryptString(String)
Encrypts the string using the default password.
Declaration
public static string EncryptString(string data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | data | String to encrypt. |
Returns
| Type | Description |
|---|---|
| System.String | The encrypted string. |
Remarks
The password used to encrypt a string can be set via DefaultPassword property. You also may use the EncryptString(String, String) method if you want to specify another password.
EncryptString(String, String)
Encrypts the string using specified password.
Declaration
public static string EncryptString(string data, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | data | String to encrypt. |
| System.String | password | The password. |
Returns
| Type | Description |
|---|---|
| System.String | The encrypted string. |
IsStreamEncrypted(Stream)
Checks if the stream contains a crypt signature.
Declaration
public static bool IsStreamEncrypted(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream to check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if stream is crypted. |