Code example for NoSuchAlgorithmException

0
        final String modeUpper = mode.toUpperCase();
        if ("NONE".equals(modeUpper) || "ECB".equals(modeUpper)) {
            return; 
        } 
 
        throw new NoSuchAlgorithmException("mode not supported: " + mode);
    } 
 
    @Override 
    protected void engineSetPadding(String padding) throws NoSuchPaddingException {
        final String paddingUpper = padding.toUpperCase();
        if ("PKCS1PADDING".equals(paddingUpper)) {
            this.padding = NativeCrypto.RSA_PKCS1_PADDING;
            return; 
        } 
        if ("NOPADDING".equals(paddingUpper)) {
            this.padding = NativeCrypto.RSA_NO_PADDING;
            return; 
        } 
 
        throw new NoSuchPaddingException("padding not supported: " + padding);