Code example for InvalidKeyException

Methods: printStackTrace

0
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        } catch (InvalidKeySpecException e) {
            e.printStackTrace();
        } catch (InvalidKeyException e) {
            e.printStackTrace();
        } catch (NoSuchPaddingException e) {
            e.printStackTrace();
        } catch (IllegalBlockSizeException e) {
            e.printStackTrace();
        } catch (BadPaddingException e) {
            e.printStackTrace();
        } 
 
    } 
 
    /** 
     * Encrypts the body of the message, using the provided public key certificate of the intended 
     * recipient. Only X.509 certificates using RSA public keys are currently supported. 
     *  
     * @param PublicKey Certificate for the message receipent's public key