@@ -106,8 +106,8 @@ public HyperwalletEncryption(JWEAlgorithm encryptionAlgorithm, JWSAlgorithm sign
106
106
107
107
public String encrypt (String body ) throws JOSEException , IOException , ParseException {
108
108
109
- JWK clientPrivateKey = getKeyByAlgorithm (loadKeySet ( clientPrivateKeySetLocation ), signAlgorithm );
110
- JWK hyperwalletPublicKey = getKeyByAlgorithm (loadKeySet ( hyperwalletKeySetLocation ), encryptionAlgorithm );
109
+ JWK clientPrivateKey = getKeyByAlgorithm (loadClientPrivateKeySet ( ), signAlgorithm );
110
+ JWK hyperwalletPublicKey = getKeyByAlgorithm (loadHyperwalletKeySet ( ), encryptionAlgorithm );
111
111
JWSSigner jwsSigner = getJWSSigner (clientPrivateKey );
112
112
JWEEncrypter jweEncrypter = getJWEEncrypter (hyperwalletPublicKey );
113
113
@@ -132,8 +132,8 @@ public String encrypt(String body) throws JOSEException, IOException, ParseExcep
132
132
133
133
public String decrypt (String body ) throws ParseException , IOException , JOSEException {
134
134
135
- JWK privateKeyToDecrypt = getKeyByAlgorithm (loadKeySet ( clientPrivateKeySetLocation ), encryptionAlgorithm );
136
- JWK publicKeyToSign = getKeyByAlgorithm (loadKeySet ( hyperwalletKeySetLocation ), signAlgorithm );
135
+ JWK privateKeyToDecrypt = getKeyByAlgorithm (loadClientPrivateKeySet ( ), encryptionAlgorithm );
136
+ JWK publicKeyToSign = getKeyByAlgorithm (loadHyperwalletKeySet ( ), signAlgorithm );
137
137
JWEDecrypter jweDecrypter = getJWEDecrypter (privateKeyToDecrypt );
138
138
JWSVerifier jwsVerifier = getJWSVerifier (publicKeyToSign );
139
139
@@ -148,6 +148,20 @@ public String decrypt(String body) throws ParseException, IOException, JOSEExcep
148
148
return jwsObject .getPayload ().toString ();
149
149
}
150
150
151
+ /**
152
+ * Allows clients to implement a custom loading of their private JWK set.
153
+ */
154
+ protected JWKSet loadClientPrivateKeySet () throws IOException , ParseException {
155
+ return loadKeySet (clientPrivateKeySetLocation );
156
+ }
157
+
158
+ /**
159
+ * Allows clients to implement a custom loading of Hyperwallet public JWK set.
160
+ */
161
+ protected JWKSet loadHyperwalletKeySet () throws IOException , ParseException {
162
+ return loadKeySet (hyperwalletKeySetLocation );
163
+ }
164
+
151
165
public void verifySignatureExpirationDate (Object signatureExpirationDate ) {
152
166
if (signatureExpirationDate == null ) {
153
167
throw new HyperwalletException ("exp JWS header param was null" );
@@ -389,4 +403,4 @@ public HyperwalletEncryption build() {
389
403
return hyperwalletEncryption ;
390
404
}
391
405
}
392
- }
406
+ }
0 commit comments