![]() |
LicenseSpring .Net SDK 8.1.0
Easily add Software Licensing to your application
|
AES-256-GCM encryption provider using the LSLF binary format. Implements ICryptoProvider so it can be substituted for the legacy CryptoProvider via Configuration.CryptoProvider.
More...
Public Member Functions | |
| CryptoProviderV2 () | |
| CryptoProviderV2 constructor. | |
| CryptoProviderV2 (IConfiguration config) | |
| CryptoProviderV2 constructor, initialize object with data from Configuration. | |
| CryptoProviderV2 (string key, string salt=null) | |
| CryptoProviderV2 constructor, initialize object with given key and salt. | |
| string | Decrypt (string inputString) |
| string | Encrypt (string inputString) |
| byte[] | ExtractSalt (string data) |
Extracts the 16-byte salt from an existing new-format Latin-1-packed string. Returns null if the data is not in new format or is too short. | |
| bool | IsNewFormat (byte[] raw) |
Returns true if the raw byte array starts with the LSLF magic bytes. | |
| bool | IsNewFormat (string data) |
Returns true if the Latin-1-packed input starts with the LSLF magic bytes. | |
Properties | |
| string | Key [get, set] |
| Encryption password (PBKDF2 input). | |
| string | Salt [get, set] |
| Base64-encoded 16-byte salt to reuse on the next Encrypt(string). Null or empty means "generate a fresh random salt". Ignored by Decrypt(string). | |
Properties inherited from LicenseSpring.ICryptoProvider | |
AES-256-GCM encryption provider using the LSLF binary format. Implements ICryptoProvider so it can be substituted for the legacy CryptoProvider via Configuration.CryptoProvider.
Binary layout of the produced payload (written verbatim to disk — no base64, no text encoding): Offset Size Field 0 4 Magic: 0x4C 0x53 0x4C 0x46 ("LSLF") 4 2 Format version: 0x01 0x00 (uint16 LE) 6 1 Cipher ID: 0x01 (AES-256-GCM) 7 1 KDF ID: 0x01 (PBKDF2-SHA256) 8 4 KDF iteration count: uint32 LE (100000) 12 16 Salt (random, generated once per file) 28 12 IV/nonce (random, regenerated on every write) 40 ... Ciphertext with 16-byte GCM authentication tag appended
AAD = header bytes [0..40).
The ICryptoProvider contract is string-shaped but the returned/accepted string is a transparent byte container packed with ISO-8859-1 (Latin-1). Every byte 0x00..0xFF maps to a single UTF-16 code unit in U+0000..U+00FF, so arbitrary binary bytes round-trip through the string without normalization or surrogate concerns.
The instance Salt property holds the base64-encoded 16-byte salt used as PBKDF2 input on the next Encrypt(string) call. When null or empty, a fresh random salt is generated. Decrypt(string) ignores it — the salt is read from the blob's header.
| LicenseSpring.CryptoProviderV2.CryptoProviderV2 | ( | IConfiguration | config | ) |
CryptoProviderV2 constructor, initialize object with data from Configuration.
| config | LicenseSpring Configuration |
| LicenseSpring.CryptoProviderV2.CryptoProviderV2 | ( | string | key, |
| string | salt = null |
||
| ) |
CryptoProviderV2 constructor, initialize object with given key and salt.
| key | Encryption password (PBKDF2 input). |
| salt | Optional base64-encoded 16-byte salt to reuse on the next Encrypt(string) call. |
| string LicenseSpring.CryptoProviderV2.Decrypt | ( | string | inputString | ) |
Decrypt given string.
| inputString | The encrypted payload previously produced by Encrypt(string), supplied back byte-for-byte. |
| System.ArgumentNullException | In case input data is null or empty. |
| System.InvalidOperationException | In case the method was called without prior setting the Key property. |
Implements LicenseSpring.ICryptoProvider.
| string LicenseSpring.CryptoProviderV2.Encrypt | ( | string | inputString | ) |
Encrypt given string.
| inputString | String to encrypt |
| System.InvalidOperationException | In case the method was called without prior setting the Key property. |
Implements LicenseSpring.ICryptoProvider.
|
getset |
Encryption password (PBKDF2 input).
Implements LicenseSpring.ICryptoProvider.
|
getset |
Base64-encoded 16-byte salt to reuse on the next Encrypt(string). Null or empty means "generate a fresh random salt". Ignored by Decrypt(string).
Implements LicenseSpring.ICryptoProvider.