question: protected void verify ( PrivateKey privateKey , Certificate cert ) throws ResourceException { PublicKey publicKey = cert . getPublicKey ( ) ; byte [ ] data = { 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 } ; boolean verified ; try { Signature signer = Signature . getInstance ( privateKey . getAlgorithm ( ) ) ; signer . initSign ( privateKey ) ; signer . update ( data ) ; byte [ ] signed = signer . sign ( ) ; Signature verifier = Signature . getInstance ( publicKey . getAlgorithm ( ) ) ; verifier . initVerify ( publicKey ) ; verifier . update ( data ) ; verified = verifier . verify ( signed ) ; } catch ( Exception e ) { throw new InternalServerErrorException ( "Error verifying private key and signed certificate" , e ) ; } if ( ! verified ) { throw new BadRequestException ( "Private key does not match signed certificate" ) ; } }
target:  Verifies that the supplied private key and signed certificate match by signing/verifying some test data.