Skip to content

Commit 3ddd0d4

Browse files
committed
second keyjar added
1 parent 15ad510 commit 3ddd0d4

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/test/java/org/oidc/msg/BaseMessageTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public abstract class BaseMessageTest<T extends AbstractMessage> {
4848

4949
private static final String PRIVATE_KEY_FILE = "src/test/resources/rsa-private.pem";
5050
private static final String PUBLIC_KEY_FILE = "src/test/resources/rsa-public.pem";
51+
private static final String PUBLIC_KEY_FILE2 = "src/test/resources/rsa-public2.pem";
5152
//TODO: return keyOwner to https://issuer.example.com once edmund explains how parameter is used in getJWTVerifyKeys
5253
protected String keyOwner = "https://issuer.example.com";
5354
protected KeyJar keyJarOfPrivateKeys = null;
@@ -193,6 +194,25 @@ protected KeyJar getKeyJarPub()
193194
keyJarOfPublicKeys.addKeyBundle(keyOwner, keyBundlePub);
194195
return keyJarOfPublicKeys;
195196
}
197+
198+
/**
199+
* Creates a second key jar with no corresponding private key.
200+
*
201+
* @return keyjar
202+
* @throws JWKException
203+
* @throws IOException
204+
*
205+
*/
206+
protected KeyJar getKeyJarPub2()
207+
throws ImportException, UnknownKeyType, IllegalArgumentException, ValueError, IOException, JWKException {
208+
KeyJar keyJarOfPublicKeys2 = new KeyJar();
209+
ArrayList<String> usesPub = new ArrayList<String>();
210+
usesPub.add("ver");
211+
usesPub.add("enc");
212+
KeyBundle keyBundlePub = KeyBundle.keyBundleFromLocalFile(PUBLIC_KEY_FILE2, "der", usesPub);
213+
keyJarOfPublicKeys2.addKeyBundle(keyOwner, keyBundlePub);
214+
return keyJarOfPublicKeys2;
215+
}
196216

197217
/**
198218
* Generates simple id token jwt string for tests

src/test/resources/rsa-public2.pem

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtjKfiIDI5iBrBnKj4xwq
3+
d++aK5WrBKsVdAVtiTm+YX/wQKO40G/9leiKoLoTyCLw71B+QoMjtHWj6XctVsJ/
4+
1faE3TLXXC1jJCa6BDZq3ohv7oX3Jdn/kzx7ApKvLlDRHWp1NGGis7SVIZ9jVvi0
5+
jqIASfnF80O+Cu4CZpT2S4Le363usu1/eARdPiwihqFBGnEThuX6c5zFXm6um09f
6+
pB9zI4Wluvbc1YMWZU0PW883mrbwBT/pc7d0tlgWSMod6JaA0tYp/G3oZYBriZ/I
7+
RGh8L/nNVbcze50CBbKROB/JJcAIhAdGvlp9J9AHHpkCSJWJOOgoGfjJABxkcPQZ
8+
PwIDAQAB
9+
-----END PUBLIC KEY-----

0 commit comments

Comments
 (0)