Encrypted Properties

Configuring encrypted properties in Konstrukt, the back office UI builder for Umbraco.

There are times when you may need to collect sensitive information in a collection however don't want to persist this in a plain text format to the data storage mechanism. Konstrukt can help with this by allowing you to define properties as encrypted after which any time the value is persisted or retrieved from persistence, Konstrukt will automatically encrypt and decreypt the value.

Konstrukt uses the IDataProtectionProvider instance registered in the DI container to perform it's encryption / decription. If you need to change the encryption alogirithm, you should replace the IDataProtectionProvider instance in the the DI container.

Defining encrypted properties

AddEncryptedProperty(Lambda encryptedPropertyExpression) : KonstruktCollectionConfigBuilder<TEntityType>

Adds the given property to the encrypted properties collection. Property must be of type String. When set, the property will be encrypted/decrypted on write/read respectively.

// Example
collectionConfig.AddEncryptedProperty(p => p.Secret);

Last updated