/** * Decrypts an encrypted value into a string using an alternative secret. * * @return {String} Decrypted string value * @memberOf EcEncryptedValue * @method decryptIntoString */ public String decryptIntoStringUsingSecret(EbacEncryptedSecret decryptSecret) { if (decryptSecret != null) { return EcAesCtr.decrypt(payload, decryptSecret.secret, decryptSecret.iv); } return null; }
/** * Decrypts an encrypted value into a string * * @return {String} Decrypted string value * @memberOf EcEncryptedValue * @method decryptIntoString */ public String decryptIntoString() { EbacEncryptedSecret decryptSecret = decryptSecret(); if (decryptSecret != null) { return EcAesCtr.decrypt(payload, decryptSecret.secret, decryptSecret.iv); } return null; }
/** * Helper function to decrypt an encrypted contact (storable version of an contact) * into an contact * * @param {EbacContact} contact * Contact to decrypt. * @param {String} secret * AES secret used to decrypt the credential. * @param {String} source * Source of the credential, used to track where a contact * came from. * @return {EcContact} * Decrypted identity object, ready for use. * @memberOf EcContact * @method fromEncryptedContact * @static */ public static EcContact fromEncryptedContact(EbacContact contact, String secret, String source) { EcContact i = new EcContact(); i.pk = EcPk.fromPem(EcAesCtr.decrypt(contact.pk, secret, contact.iv)); i.source = source; if (contact.displayName != null && contact.displayNameIv != null) i.displayName = EcAesCtr.decrypt(contact.displayName, secret, contact.iv); return i; }
/** * Helper function to decrypt a credential (storable version of an identity) * into an identity) * * @param {EbacCredential} credential * Credential to decrypt. * @param {String} secret * AES secret used to decrypt the credential. * @param {String} source * Source of the credential, used to track where a credential * came from. * @return {EcIdentity} * Decrypted identity object, ready for use. * @memberOf EcIdentity * @method fromCredential * @static */ public static EcIdentity fromCredential(EbacCredential credential, String secret, String source) { EcIdentity i = new EcIdentity(); i.ppk = EcPpk.fromPem(EcAesCtr.decrypt(credential.ppk, secret, credential.iv)); i.source = source; if (credential.displayName != null && credential.displayNameIv != null) i.displayName = EcAesCtr.decrypt(credential.displayName, secret, credential.iv); return i; }