-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pollux): ATL-3900 Force use of Bouncycastle (#463)
* fix(pollux): ATL-3900 Force use of Bouncycastle * updated the mercury version --------- Co-authored-by: Shailesh Patil <[email protected]>
- Loading branch information
1 parent
8444057
commit 5b4aa5d
Showing
6 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
pollux/lib/vc-jwt/src/test/scala/io/iohk/atala/pollux/vc/jwt/ECDSAVerifierTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.iohk.atala.pollux.vc.jwt | ||
|
||
import com.nimbusds.jose.crypto.ECDSASigner | ||
import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton | ||
import com.nimbusds.jose.jwk.Curve | ||
import com.nimbusds.jose.jwk.gen.ECKeyGenerator | ||
import io.circe.Json | ||
import org.bouncycastle.jce.provider.BouncyCastleProvider | ||
import org.scalatest.funsuite.AnyFunSuite | ||
import org.scalatest.matchers.must.Matchers.mustBe | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
import java.security.PrivateKey | ||
import java.security.interfaces.ECPrivateKey | ||
|
||
class ECDSAVerifierTest extends AnyFunSuite with Matchers { | ||
|
||
test("toECDSAVerifier should use BouncyCastleProviderSingleton") { | ||
val ecKey = ECKeyGenerator(Curve.SECP256K1).generate() | ||
val verifier = JWTVerification.toECDSAVerifier(ecKey.toPublicKey) | ||
val provider = verifier.getJCAContext.getProvider | ||
provider mustBe a[BouncyCastleProvider] | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
pollux/lib/vc-jwt/src/test/scala/io/iohk/atala/pollux/vc/jwt/ES256KSignerTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.iohk.atala.pollux.vc.jwt | ||
|
||
import com.nimbusds.jose.crypto.ECDSASigner | ||
import com.nimbusds.jose.crypto.bc.BouncyCastleProviderSingleton | ||
import com.nimbusds.jose.jwk.Curve | ||
import com.nimbusds.jose.jwk.gen.ECKeyGenerator | ||
import io.circe.Json | ||
import org.bouncycastle.jce.provider.BouncyCastleProvider | ||
import org.scalatest.funsuite.AnyFunSuite | ||
import org.scalatest.matchers.must.Matchers.mustBe | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
import java.security.PrivateKey | ||
import java.security.interfaces.ECPrivateKey | ||
|
||
class ES256KSignerTest extends AnyFunSuite with Matchers { | ||
|
||
test("ES256KSigner should use BouncyCastleProviderSingleton") { | ||
val ecKey = ECKeyGenerator(Curve.SECP256K1).generate() | ||
val signer = new ES256KSigner(ecKey.toPrivateKey).signer | ||
val provider = signer.getJCAContext.getProvider | ||
provider mustBe a[BouncyCastleProvider] | ||
} | ||
} |