# Symmetric Encryption Provider

`ISymmetricCryptographicProvider` in assembly SanteDB.Core.Api version 3.0.1980.0

## Summary

Represents a crypto service provider that encrypts things using symmetric encryption

## Operations

| Operation              | Response/Return | Input/Parameter                                                                                                                           | Description                 |
| ---------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| GetContextKey          | Byte\[]         | *none*                                                                                                                                    | TODO                        |
| RotateContextKey       | Boolean         | *none*                                                                                                                                    | TODO                        |
| GenerateIV             | Byte\[]         | *none*                                                                                                                                    | TODO                        |
| GenerateKey            | Byte\[]         | *none*                                                                                                                                    | TODO                        |
| Encrypt                | Byte\[]         | <p><em>Byte\[]</em> <strong>data</strong><br><em>Byte\[]</em> <strong>key</strong><br><em>Byte\[]</em> <strong>iv</strong></p>            | Encrypts the sepcified data |
| Decrypt                | Byte\[]         | <p><em>Byte\[]</em> <strong>data</strong><br><em>Byte\[]</em> <strong>key</strong><br><em>Byte\[]</em> <strong>iv</strong></p>            | Decrypts the specified data |
| Encrypt                | Byte\[]         | *Byte\[]* **data**                                                                                                                        | Encrypts the sepcified data |
| Decrypt                | Byte\[]         | *Byte\[]* **data**                                                                                                                        | Decrypts the specified data |
| Encrypt                | String          | *String* **data**                                                                                                                         | Encrypts the sepcified data |
| Decrypt                | String          | *String* **data**                                                                                                                         | Decrypts the specified data |
| CreateEncryptingStream | Stream          | <p><em>Stream</em> <strong>underlyingStream</strong><br><em>Byte\[]</em> <strong>key</strong><br><em>Byte\[]</em> <strong>iv</strong></p> | Create a decrypting stream  |
| CreateDecryptingStream | Stream          | <p><em>Stream</em> <strong>underlyingStream</strong><br><em>Byte\[]</em> <strong>key</strong><br><em>Byte\[]</em> <strong>iv</strong></p> | Create a decrypting stream  |

## Implementations

### AesSymmetricCrypographicProvider - (SanteDB.Core.Api)

Represents a symmetric cryptographic provider based on AES

#### Service Registration

```markup
...
<section xsi:type="ApplicationServiceContextConfigurationSection" threadPoolSize="4">
	<serviceProviders>
		...
		<add type="SanteDB.Core.Security.AesSymmetricCrypographicProvider, SanteDB.Core.Api, Version=3.0.1980.0, Culture=neutral, PublicKeyToken=null" />
		...
	</serviceProviders>
```

## Example Implementation

```csharp
/// Example Implementation
using SanteDB.Core.Security.Services;
/// Other usings here
public class MySymmetricCryptographicProvider : SanteDB.Core.Security.Services.ISymmetricCryptographicProvider { 
	public String ServiceName => "My own ISymmetricCryptographicProvider service";
	public Byte[] GetContextKey(){
		throw new System.NotImplementedException();
	}
	public Boolean RotateContextKey(){
		throw new System.NotImplementedException();
	}
	public Byte[] GenerateIV(){
		throw new System.NotImplementedException();
	}
	public Byte[] GenerateKey(){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Encrypts the sepcified data
	/// </summary>
	public Byte[] Encrypt(Byte[] data,Byte[] key,Byte[] iv){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Decrypts the specified data
	/// </summary>
	public Byte[] Decrypt(Byte[] data,Byte[] key,Byte[] iv){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Encrypts the sepcified data
	/// </summary>
	public Byte[] Encrypt(Byte[] data){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Decrypts the specified data
	/// </summary>
	public Byte[] Decrypt(Byte[] data){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Encrypts the sepcified data
	/// </summary>
	public String Encrypt(String data){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Decrypts the specified data
	/// </summary>
	public String Decrypt(String data){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Create a decrypting stream
	/// </summary>
	public Stream CreateEncryptingStream(Stream underlyingStream,Byte[] key,Byte[] iv){
		throw new System.NotImplementedException();
	}
	/// <summary>
	/// Create a decrypting stream
	/// </summary>
	public Stream CreateDecryptingStream(Stream underlyingStream,Byte[] key,Byte[] iv){
		throw new System.NotImplementedException();
	}
}
```

## References

* [ISymmetricCryptographicProvider C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Security_Services_ISymmetricCryptographicProvider.htm)
* [AesSymmetricCrypographicProvider C# Documentation](http://santesuite.org/assets/doc/net/html/T_SanteDB_Core_Security_AesSymmetricCrypographicProvider.htm)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.santesuite.org/developers/server-plugins/implementing-.net-features/service-definitions/symmetric-encryption-provider.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
