Code example for NoSuchPaddingException

0
        MGF1ParameterSpec mgfParams = (MGF1ParameterSpec)pSpec.getMGFParameters();
        Digest digest = DigestFactory.getDigest(mgfParams.getDigestAlgorithm());
         
        if (digest == null)
        { 
            throw new NoSuchPaddingException("no match on OAEP constructor for digest algorithm: "+ mgfParams.getDigestAlgorithm());
        } 
 
        cipher = new OAEPEncoding(new RSABlindedEngine(), digest, ((PSource.PSpecified)pSpec.getPSource()).getValue());
        paramSpec = pSpec;
    } 
     
    protected int engineGetBlockSize()  
    { 
        try 
        { 
            return cipher.getInputBlockSize();
        } 
        catch (NullPointerException e)
        { 
            throw new IllegalStateException("RSA Cipher not initialised");