/** * Helper function to encrypt a contact into an encrypted contact (storable * version of a contact) * * @param {String} secret * AES secret used to encrypt the contact. * @return {EbacContact} * Encrypted contact object. * @memberOf EcContact * @method toEncryptedContact */ public EbacContact toEncryptedContact(String secret) { EbacContact c = new EbacContact(); c.iv = EcAes.newIv(32); c.pk = EcAesCtr.encrypt(pk.toPem(), secret, c.iv); c.displayNameIv = EcAes.newIv(16); c.displayName = EcAesCtr.encrypt(displayName, secret, c.iv); c.sourceIv = EcAes.newIv(16); c.source = EcAesCtr.encrypt(source, secret, c.iv); return c; } }
/** * Helper function to encrypt an identity into a credential (storable * version of an identity) * * @param {String} secret * AES secret used to encrypt the credential. * @return {EbacCredential} * Encrypted credential object. * @memberOf EcIdentity * @method toCredential */ public EbacCredential toCredential(String secret) { EbacCredential c = new EbacCredential(); c.iv = EcAes.newIv(16); c.ppk = EcAesCtr.encrypt(ppk.toPem(), secret, c.iv); c.displayNameIv = EcAes.newIv(16); c.displayName = EcAesCtr.encrypt(displayName, secret, c.iv); return c; }
v.payload = EcAesCtr.encrypt(text, newSecret, newIv); v.addOwner(owner);
EcEncryptedValue v = new EcEncryptedValue(); v.payload = EcAesCtr.encrypt(text, secret, iv); if (owners != null) { for (int i = 0; i < owners.$length(); i++) {
v.payload = EcAesCtr.encrypt(d.toJson(), newSecret, newIv); v.owner = d.owner; v.reader = d.reader;
v.payload = EcAesCtr.encrypt(text, newSecret, newIv); if (owners != null) { for (int i = 0; i < owners.$length(); i++) {