JWS PS256 with the BouncyCastle FIPS provider
The Nimbus JOSE+JWT library received an
update
in version 9.6 to handle the BouncyCastle
FIPS algorithm names required to instantiate
PS256
, PS384
and PS512
JWS signers and verifiers.
Example Java code for creating a PS256
signer and verifier with the
BouncyCastle FIPS provider:
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import com.nimbusds.jose.*;
import com.nimbusds.jose.crypto.*;
import com.nimbusds.jose.crypto.bc.BouncyCastleFIPSProviderSingleton;
// Create RSA signer and set BC FIPS provider
JWSSigner signer = new RSASSASigner(privateKey);
signer.getJCAContext().setProvider(BouncyCastleFIPSProviderSingleton.getInstance());
// Sign
JWSObject jwsObject = new JWSObject(
new JWSHeader.Builder(JWSAlgorithm.PS256).build(),
new Payload("Some payload"));
jwsObject.sign(signer);
// Create RSA verifier and set BC FIPS provider
JWSVerifier verifier = new RSASSAVerifier(publicKey);
verifier.getJCAContext().setProvider(BouncyCastleFIPSProviderSingleton.getInstance());
// Verify signature
assertTrue(jwsObject.verify(verifier));
Nimbus JOSE + JWT
-
Examples
- JWS with HMAC protection
- JWS with RSA signature
- JWS with EC signature
- JWS with EdDSA / Ed25519
- JWS with JSON serialisation
- JWT with HMAC protection
- JWT with RSA signature
- JWT with EC signature
- JWT with ES256K signature
- JWT with EdDSA / Ed25519 signature
- JWS with unencoded payload
- JWS with Android biometric prompt
- PS256 with BouncyCastle FIPS
- JWS with Google Cloud KMS
- JWS with Google Cloud KMS
- JWT with RSA encryption
- JWE with shared key
- Signed & encrypted JWT
- JWE with XC20P
- JWE with preset CEK
- JWE with multiple recipients
- JWS minting framework
- Validating access tokens
- JOSE / JWT parsing
- Combined JOSE parsing
- Combined JWT parsing
- JWK generation
- JWK conversion
- JWK thumbprints
- JWK exp, nbf and iat times
- JWK selectors
- JWK set retrieval
- Enhanced JWK set retrieval
- JWK from PEM-encoded objects
- X.509 certificates
- Smart card and HSM use
- JWS HS256 with AWS CloudHSM
- Algorithm selection guide
- Command line JWK generator
- Security vulnerabilities
- JavaDocs
- OpenSSL key generation
- JCA algorithm support
- FAQ
- Roadmap
- Report bugs and contribute
- Download