BLicenseWeb - Esempi
Nome del file licenza
using B.BSecurity;
BLicenseWeb license = new BLicenseWeb(temporaryLicensePassword);
string fileName = license.CreateFileNameLicenza(
IDLicenza: 125,
RagSoc: "Cliente S.p.A.");
Il nome viene normalizzato in maiuscolo, usa il prefisso BKEY_, include un codice derivato dalla ragione sociale e l'identificativo a sette cifre, e termina con .BSK.
Creazione e verifica
string key = license.GeneraCodice(
"Cliente S.p.A.",
"BArts Web Application",
IDSoft: 42,
VerMag: 5,
IDLic: licenseId);
bool created = license.CreaFileLicenza(
outputDirectory,
licenseId,
"Cliente S.p.A.",
key,
"BASE;API");
string licensePath = Path.Combine(
outputDirectory,
license.CreateFileNameLicenza(licenseId, "Cliente S.p.A."));
bool valid = license.CheckLic(
licensePath,
IDSoft: "42",
DescrSoft: "BArts Web Application",
VerMag: 5);
BLicenseWeb autentica il costruttore tramite una password temporale prodotta dal meccanismo BCrypter.GetSecurePassword/CheckSecurePassword. La credenziale deve arrivare dal servizio autorizzato B-Arts e non essere ricostruita nel codice applicativo.
Il file .bsk è XML con campi cifrati. GetRagSoc e GetModuli restituiscono i valori decifrati oppure una stringa vuota quando il file non è leggibile o valido.
