Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import com.flowcrypt.email.api.email.model.AttachmentInfo
import com.flowcrypt.email.api.email.model.IncomingMessageInfo
import com.flowcrypt.email.base.BaseTest
import com.flowcrypt.email.database.FlowCryptRoomDatabase
import com.flowcrypt.email.extensions.pgp.expiration
import com.flowcrypt.email.extensions.org.bouncycastle.openpgp.expiration
import com.flowcrypt.email.matchers.CustomMatchers.Companion.withAppBarLayoutBackgroundColor
import com.flowcrypt.email.matchers.CustomMatchers.Companion.withChipsBackgroundColor
import com.flowcrypt.email.model.KeyDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ interface MsgBlock : Parcelable {
val replaceableBlockTypes = setOf(
PUBLIC_KEY, PRIVATE_KEY, SIGNED_MSG, ENCRYPTED_MSG, ENCRYPTED_MSG_LINK
)
val fourBlockTypes = setOf(
val wellKnownBlockTypes = setOf(
PUBLIC_KEY, PRIVATE_KEY, SIGNED_MSG, ENCRYPTED_MSG
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package com.flowcrypt.email.core.msg
import com.flowcrypt.email.api.retrofit.response.model.node.MsgBlock
import com.flowcrypt.email.api.retrofit.response.model.node.MsgBlockFactory
import com.flowcrypt.email.security.pgp.PgpArmor
import com.flowcrypt.email.extensions.lang.normalize
import com.flowcrypt.email.extensions.kotlin.normalize

@Suppress("unused")
object MsgBlockParser {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import com.flowcrypt.email.api.email.gmail.api.GmaiAPIMimeMessage
import com.flowcrypt.email.api.email.model.MessageFlag
import com.flowcrypt.email.api.email.model.OutgoingMessageInfo
import com.flowcrypt.email.database.MessageState
import com.flowcrypt.email.extensions.lang.toHex
import com.flowcrypt.email.extensions.kotlin.toHex
import com.flowcrypt.email.extensions.uid
import com.flowcrypt.email.ui.activity.fragment.preferences.NotificationsSettingsFragment
import com.flowcrypt.email.util.SharedPreferencesHelper
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com
* Contributors: ivan
*/

package com.flowcrypt.email.extensions.kotlin

object ByteExtHelper {
const val tab = '\t'.toByte()
const val space = ' '.toByte()
const val cr = '\r'.toByte()
const val lf = '\n'.toByte()
}

val Byte.isLineEnding: Boolean get() {
return this == ByteExtHelper.cr || this == ByteExtHelper.lf
}

val Byte.isWhiteSpace: Boolean get() {
return isLineEnding || this == ByteExtHelper.tab || this == ByteExtHelper.space
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Ivan Pizhenko
*/

package com.flowcrypt.email.extensions.lang
package com.flowcrypt.email.extensions.kotlin

import java.util.Locale

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Contributors: Ivan Pizhenko
*/

package com.flowcrypt.email.extensions.lang
package com.flowcrypt.email.extensions.kotlin

object StringExtensionsHelper {
@JvmStatic
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/*
* © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com
* Contributors:
* DenBond7
* Ivan Pizhenko
* Contributors: ivan
*/

package com.flowcrypt.email.extensions.pgp
package com.flowcrypt.email.extensions.org.bouncycastle.openpgp

import com.flowcrypt.email.api.retrofit.response.model.node.Algo
import com.flowcrypt.email.api.retrofit.response.model.node.KeyId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com
* Contributors: Ivan Pizhenko
* Contributors: ivan
*/

package com.flowcrypt.email.extensions.pgp
package com.flowcrypt.email.extensions.org.bouncycastle.openpgp

import org.bouncycastle.openpgp.PGPPublicKeyRing
import org.bouncycastle.openpgp.PGPSecretKeyRing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.flowcrypt.email.util.exception.WrongPassPhraseException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.pgpainless.util.Passphrase

/**
* @author Denis Bondarenko
Expand Down Expand Up @@ -56,7 +57,7 @@ class CheckPrivateKeysViewModel(application: Application) : BaseAndroidViewModel
copy.passphrase = passphrase
} else {
try {
PgpKey.decryptKey(prvKey, passphrase)
PgpKey.decryptKey(prvKey, Passphrase.fromPassword(passphrase))
copy.passphrase = passphrase
} catch (ex: Exception) {
//to prevent leak sensitive info we skip printing stack trace for release builds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.flowcrypt.email.database.entity.AccountEntity
import com.flowcrypt.email.database.entity.AttachmentEntity
import com.flowcrypt.email.database.entity.LabelEntity
import com.flowcrypt.email.database.entity.MessageEntity
import com.flowcrypt.email.extensions.lang.toHex
import com.flowcrypt.email.extensions.kotlin.toHex
import com.flowcrypt.email.jetpack.workmanager.sync.CheckIsLoadedMessagesEncryptedWorker
import com.flowcrypt.email.model.EmailAndNamePair
import com.flowcrypt.email.service.EmailAndNameUpdaterService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.flowcrypt.email.api.retrofit.response.base.Result
import com.flowcrypt.email.api.retrofit.response.model.node.NodeKeyDetails
import com.flowcrypt.email.database.entity.AccountEntity
import com.flowcrypt.email.database.entity.ActionQueueEntity
import com.flowcrypt.email.extensions.pgp.toNodeKeyDetails
import com.flowcrypt.email.extensions.org.bouncycastle.openpgp.toNodeKeyDetails
import com.flowcrypt.email.model.KeyDetails
import com.flowcrypt.email.model.KeyImportModel
import com.flowcrypt.email.model.PgpContact
Expand All @@ -53,6 +53,7 @@ import kotlinx.coroutines.withContext
import org.pgpainless.PGPainless
import org.pgpainless.key.collection.PGPKeyRingCollection
import org.pgpainless.key.util.UserId
import org.pgpainless.util.Passphrase
import java.util.*

/**
Expand Down Expand Up @@ -399,7 +400,9 @@ class PrivateKeysViewModel(application: Application) : BaseNodeApiViewModel(appl
val encryptedKey: String
try {
encryptedKey = PgpKey.changeKeyPassphrase(
nodeKeyDetails.privateKey!!, oldPassphrase!!, newPassphrase
nodeKeyDetails.privateKey!!,
Passphrase.fromPassword(oldPassphrase!!),
Passphrase.fromPassword(newPassphrase)
)
} catch (e: Exception) {
throw IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.flowcrypt.email.database.MessageState
import com.flowcrypt.email.database.entity.AccountEntity
import com.flowcrypt.email.database.entity.AttachmentEntity
import com.flowcrypt.email.database.entity.MessageEntity
import com.flowcrypt.email.extensions.lang.toHex
import com.flowcrypt.email.extensions.kotlin.toHex
import com.flowcrypt.email.jetpack.viewmodel.AccountViewModel
import com.flowcrypt.email.security.SecurityUtils
import com.flowcrypt.email.security.pgp.PgpEncrypt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.flowcrypt.email.api.email.EmailUtil
import com.flowcrypt.email.api.email.model.LocalFolder
import com.flowcrypt.email.database.entity.AccountEntity
import com.flowcrypt.email.database.entity.MessageEntity
import com.flowcrypt.email.extensions.lang.toHex
import com.flowcrypt.email.extensions.kotlin.toHex
import com.flowcrypt.email.service.MessagesNotificationManager
import com.flowcrypt.email.util.GeneralUtil
import com.sun.mail.imap.IMAPFolder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.flowcrypt.email.util.exception.PrivateKeyStrengthException
import com.google.android.gms.common.util.CollectionUtils
import org.apache.commons.codec.android.binary.Hex
import org.apache.commons.codec.android.digest.DigestUtils
import org.pgpainless.util.Passphrase
import java.util.*

/**
Expand Down Expand Up @@ -84,7 +85,7 @@ class SecurityUtils {
val keyDetails = nodeKeyDetailsList.first()

val encryptedKey = if (keyDetails.isFullyDecrypted == true) {
PgpKey.encryptKey(private, passPhrase)
PgpKey.encryptKey(private, Passphrase.fromPassword(passPhrase))
} else {
keyDetails.privateKey
}
Expand Down
Loading