Added patched TomP2P and disable signature encoding/decoding

This commit is contained in:
ChronosX88 2019-04-10 16:29:19 +04:00
parent 55b298678d
commit 233fa69193
18 changed files with 3 additions and 13 deletions

View File

@ -38,14 +38,11 @@ android {
dependencies { dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation fileTree(include: ['*.jar'], dir: 'libs/tomp2p')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02' implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation "androidx.room:room-runtime:2.1.0-alpha04" implementation "androidx.room:room-runtime:2.1.0-alpha04"
annotationProcessor "androidx.room:room-compiler:2.1.0-alpha04" annotationProcessor "androidx.room:room-compiler:2.1.0-alpha04"
implementation('net.tomp2p:tomp2p-all:5.0-Beta8') {
exclude group: 'net.tomp2p', module: 'tomp2p-storage'
exclude group: 'org.mapdb', module: 'mapdb'
}
implementation 'org.slf4j:slf4j-log4j12:1.7.26' implementation 'org.slf4j:slf4j-log4j12:1.7.26'
implementation group: 'com.h2database', name: 'h2-mvstore', version: '1.4.197' implementation group: 'com.h2database', name: 'h2-mvstore', version: '1.4.197'
implementation 'com.google.android.material:material:1.1.0-alpha04' implementation 'com.google.android.material:material:1.1.0-alpha04'

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -47,16 +47,10 @@ class DataSerializerEx(private val signatureFactory: SignatureFactory) : EntryBi
if (!retVal) { if (!retVal) {
Log.e(LOG_TAG, "# ERROR: Data could not be deserialized!") Log.e(LOG_TAG, "# ERROR: Data could not be deserialized!")
} }
retVal = data.decodeDone(buf, signatureFactory)
if (!retVal) {
Log.e(LOG_TAG, "# ERROR: Signature could not be read!")
}
return data return data
} }
override fun objectToEntry(data: Data, databaseEntry: DatabaseEntry) { override fun objectToEntry(data: Data, databaseEntry: DatabaseEntry) {
val forSigningKP = keyPairManager.getKeyPair("mainSigningKeyPair")
data.sign(forSigningKP)
val out = ByteArrayOutputStream() val out = ByteArrayOutputStream()
val acb = AlternativeCompositeByteBuf.compBuffer(AlternativeCompositeByteBuf.UNPOOLED_HEAP) val acb = AlternativeCompositeByteBuf.compBuffer(AlternativeCompositeByteBuf.UNPOOLED_HEAP)
try { try {
@ -68,8 +62,8 @@ class DataSerializerEx(private val signatureFactory: SignatureFactory) : EntryBi
// from memory // from memory
writeData(out, data.toByteBuffers()) writeData(out, data.toByteBuffers())
// rest // rest
data.encodeDone(acb, signatureFactory) // data.encodeDone(acb, signatureFactory)
writeData(out, acb.nioBuffers()) // writeData(out, acb.nioBuffers())
} catch (e: SignatureException) { } catch (e: SignatureException) {
e.printStackTrace() e.printStackTrace()
} catch (e: InvalidKeyException) { } catch (e: InvalidKeyException) {
@ -98,7 +92,6 @@ class DataSerializerEx(private val signatureFactory: SignatureFactory) : EntryBi
companion object { companion object {
private const val serialVersionUID = 1428836065493792295L private const val serialVersionUID = 1428836065493792295L
private val keyPairManager = KeyPairManager()
} }
} }