1
0
mirror of https://github.com/bitwarden/mobile.git synced 2025-01-13 19:41:31 +01:00

encrypt with org key if needed

This commit is contained in:
Kyle Spearrin 2017-04-20 11:40:39 -04:00
parent 18b2b6f447
commit b136bb74b8
2 changed files with 12 additions and 6 deletions

View File

@ -159,11 +159,11 @@ namespace Bit.App.Pages
return; return;
} }
login.Uri = UriCell.Entry.Text?.Encrypt(); login.Uri = UriCell.Entry.Text?.Encrypt(login.OrganizationId);
login.Name = NameCell.Entry.Text?.Encrypt(); login.Name = NameCell.Entry.Text?.Encrypt(login.OrganizationId);
login.Username = UsernameCell.Entry.Text?.Encrypt(); login.Username = UsernameCell.Entry.Text?.Encrypt(login.OrganizationId);
login.Password = PasswordCell.Entry.Text?.Encrypt(); login.Password = PasswordCell.Entry.Text?.Encrypt(login.OrganizationId);
login.Notes = NotesCell.Editor.Text?.Encrypt(); login.Notes = NotesCell.Editor.Text?.Encrypt(login.OrganizationId);
login.Favorite = favoriteCell.On; login.Favorite = favoriteCell.On;
if(FolderCell.Picker.SelectedIndex > 0) if(FolderCell.Picker.SelectedIndex > 0)

View File

@ -10,7 +10,7 @@ namespace Bit.App
{ {
public static class Extentions public static class Extentions
{ {
public static CipherString Encrypt(this string s) public static CipherString Encrypt(this string s, string orgId = null)
{ {
if(s == null) if(s == null)
{ {
@ -18,6 +18,12 @@ namespace Bit.App
} }
var cryptoService = Resolver.Resolve<ICryptoService>(); var cryptoService = Resolver.Resolve<ICryptoService>();
if(!string.IsNullOrWhiteSpace(orgId))
{
return cryptoService.Encrypt(s, cryptoService.GetOrgKey(orgId));
}
return cryptoService.Encrypt(s); return cryptoService.Encrypt(s);
} }