/// <summary> /// NewKey method implementation /// </summary> public override string NewKey(string upn) { if (string.IsNullOrEmpty(upn)) { return(null); } string lupn = upn.ToLower(); byte[] crypted = null; using (var prov = new RSAEncryption(_xorsecret)) { prov.Certificate = KeysStorage.CreateCertificate(lupn, _validity, true); crypted = prov.Encrypt(lupn); if (crypted == null) { return(null); } string outkey = AddStorageInfos(crypted); return(KeysStorage.NewUserKey(lupn, outkey, prov.Certificate)); } }
/// <summary> /// NewKey method implementation /// </summary> public override string NewKey(string upn) { if (string.IsNullOrEmpty(upn)) { return(null); } string lupn = upn.ToLower(); byte[] crypted = null; using (var prov = new Encryption(_xorsecret)) { prov.Certificate = KeysStorage.CreateCertificate(lupn, _validity, false); crypted = prov.Encrypt(lupn); if (crypted == null) { return(null); } string outkey = AddKeyPrefix(System.Convert.ToBase64String(crypted)); return(KeysStorage.NewUserKey(lupn, outkey, prov.Certificate)); } }
/// <summary> /// NewKey method implementation /// </summary> public override string NewKey(string upn) { if (string.IsNullOrEmpty(upn)) { return(null); } string lupn = upn.ToLower(); byte[] crypted = null; using (var prov = new RSAEncryption(XORSecret)) { string pass = CheckSumEncoding.CheckSumAsString(lupn); prov.Certificate = KeysStorage.CreateCertificate(lupn, pass, Validity); crypted = prov.NewEncryptedKey(lupn); if (crypted == null) { return(null); } string outkey = AddStorageInfos(crypted); return(KeysStorage.NewUserKey(lupn, outkey, prov.Certificate)); } }