Skip to content

Commit

Permalink
fix(deps): Upgrade Bouncy Castle to v1.70 (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea authored Mar 17, 2022
1 parent a87b9f5 commit fefc666
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,20 @@ repositories {

dependencies {
val kotlinCoroutinesVersion = "1.5.2"
val bouncyCastleVersion = "1.70"

// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesVersion")

// Bouncy Castle
implementation("org.bouncycastle:bcpkix-jdk15on:1.69")
implementation("org.bouncycastle:bcpkix-jdk15on:$bouncyCastleVersion")

// Libraries for ASN.1 serialization. We should eventually replace jASN1 with Bouncy Castle
// https://github.com/relaycorp/awala-jvm/issues/25
implementation("com.beanit:jasn1:1.11.3")
implementation("org.bouncycastle:bcprov-jdk15on:1.69")
implementation("org.bouncycastle:bcprov-jdk15on:$bouncyCastleVersion")

testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ abstract class CertificateStore {
}

private fun ASN1TaggedObject.toCertificate() =
Certificate.deserialize(`object`.encoded)
Certificate.deserialize(baseObject.encoded)
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CertificateRotation(val subjectCertificate: Certificate, val chain: List<C

val chainSequence = try {
DERSequence.getInstance(sequence[1], false)
} catch (exc: IllegalArgumentException) {
} catch (exc: IllegalStateException) {
throw InvalidMessageException("Chain is malformed", exc)
}
val chain = try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import org.bouncycastle.asn1.ASN1ObjectIdentifier
import org.bouncycastle.asn1.ASN1OctetString
import org.bouncycastle.asn1.ASN1Sequence
import org.bouncycastle.asn1.ASN1TaggedObject
import org.bouncycastle.asn1.ASN1VisibleString
import org.bouncycastle.asn1.DERGeneralizedTime
import org.bouncycastle.asn1.DEROctetString
import org.bouncycastle.asn1.DERSequence
import org.bouncycastle.asn1.DERTaggedObject
import org.bouncycastle.asn1.DERVisibleString

internal object ASN1Utils {
val BER_DATETIME_FORMATTER: DateTimeFormatter =
Expand Down Expand Up @@ -82,8 +82,8 @@ internal object ASN1Utils {
}
}

fun getVisibleString(visibleString: ASN1TaggedObject): DERVisibleString =
DERVisibleString.getInstance(visibleString, false)
fun getVisibleString(visibleString: ASN1TaggedObject): ASN1VisibleString =
ASN1VisibleString.getInstance(visibleString, false)

fun getOctetString(octetString: ASN1TaggedObject): ASN1OctetString =
DEROctetString.getInstance(octetString, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class CertificateRotationTest {
}

assertEquals("Chain is malformed", exception.message)
assertTrue(exception.cause is IllegalArgumentException)
assertTrue(exception.cause is IllegalStateException)
}

@Test
Expand Down

0 comments on commit fefc666

Please sign in to comment.