|
1 | 1 | package com.danubetech.verifiablecredentials.jwt; |
2 | 2 |
|
3 | | -import com.nimbusds.jose.*; |
4 | | -import com.nimbusds.jose.util.JSONObjectUtils; |
5 | | -import com.nimbusds.jwt.JWTClaimsSet; |
6 | 3 | import com.danubetech.keyformats.crypto.ByteSigner; |
7 | 4 | import com.danubetech.keyformats.crypto.ByteVerifier; |
8 | 5 | import com.danubetech.keyformats.crypto.impl.*; |
| 6 | +import com.nimbusds.jose.*; |
| 7 | +import com.nimbusds.jose.util.JSONObjectUtils; |
| 8 | +import com.nimbusds.jwt.JWTClaimsSet; |
9 | 9 | import info.weboftrust.ldsignatures.adapter.JWSSignerAdapter; |
10 | 10 | import info.weboftrust.ldsignatures.adapter.JWSVerifierAdapter; |
11 | 11 | import org.bitcoinj.core.ECKey; |
@@ -53,6 +53,30 @@ private String sign(JWSSigner jwsSigner, JWSAlgorithm alg, String kid, boolean c |
53 | 53 | return this.compactSerialization; |
54 | 54 | } |
55 | 55 |
|
| 56 | + public String sign_RSA_PS256(ByteSigner signer, String kid, boolean canonicalize) throws JOSEException { |
| 57 | + return this.sign(new JWSSignerAdapter(signer, JWSAlgorithm.PS256), JWSAlgorithm.PS256, kid, canonicalize); |
| 58 | + } |
| 59 | + |
| 60 | + public String sign_RSA_PS256(ByteSigner signer) throws JOSEException { |
| 61 | + return this.sign_RSA_PS256(signer, null, false); |
| 62 | + } |
| 63 | + |
| 64 | + public String sign_RSA_PS256(RSAPrivateKey privateKey, String kid, boolean canonicalize) throws JOSEException { |
| 65 | + return this.sign_RSA_PS256(new RSA_PS256_PrivateKeySigner(privateKey), kid, canonicalize); |
| 66 | + } |
| 67 | + |
| 68 | + public String sign_RSA_PS256(RSAPrivateKey privateKey) throws JOSEException { |
| 69 | + return this.sign_RSA_PS256(privateKey, null, false); |
| 70 | + } |
| 71 | + |
| 72 | + public String sign_RSA_PS256(com.nimbusds.jose.jwk.RSAKey privateKey, String kid, boolean canonicalize) throws JOSEException { |
| 73 | + return this.sign(new com.nimbusds.jose.crypto.RSASSASigner(privateKey), JWSAlgorithm.PS256, kid, canonicalize); |
| 74 | + } |
| 75 | + |
| 76 | + public String sign_RSA_PS256(com.nimbusds.jose.jwk.RSAKey privateKey) throws JOSEException { |
| 77 | + return this.sign_RSA_PS256(privateKey, null, false); |
| 78 | + } |
| 79 | + |
56 | 80 | public String sign_RSA_RS256(ByteSigner signer, String kid, boolean canonicalize) throws JOSEException { |
57 | 81 | return this.sign(new JWSSignerAdapter(signer, JWSAlgorithm.RS256), JWSAlgorithm.RS256, kid, canonicalize); |
58 | 82 | } |
@@ -133,6 +157,18 @@ private boolean verify(JWSVerifier jwsVerifier) throws JOSEException { |
133 | 157 | return this.jwsObject.verify(jwsVerifier); |
134 | 158 | } |
135 | 159 |
|
| 160 | + public boolean verify_RSA_PS256(ByteVerifier verifier) throws JOSEException { |
| 161 | + return this.verify(new JWSVerifierAdapter(verifier, JWSAlgorithm.RS256)); |
| 162 | + } |
| 163 | + |
| 164 | + public boolean verify_RSA_PS256(RSAPublicKey publicKey) throws JOSEException { |
| 165 | + return this.verify_RSA_PS256(new RSA_PS256_PublicKeyVerifier(publicKey)); |
| 166 | + } |
| 167 | + |
| 168 | + public boolean verify_RSA_PS256(com.nimbusds.jose.jwk.RSAKey publicKey) throws JOSEException { |
| 169 | + return this.verify(new com.nimbusds.jose.crypto.RSASSAVerifier(publicKey)); |
| 170 | + } |
| 171 | + |
136 | 172 | public boolean verify_RSA_RS256(ByteVerifier verifier) throws JOSEException { |
137 | 173 | return this.verify(new JWSVerifierAdapter(verifier, JWSAlgorithm.RS256)); |
138 | 174 | } |
|
0 commit comments