public String sign ( final String message ) throws EncryptionException { try { Signature sign = Signature . getInstance ( "SHA1withRSA" ) ; sign . initSign ( privateKey ) ; sign . update ( message . getBytes ( DEFAULT_CHARSET ) ) ; return new String ( Base64 . encodeBase64 ( sign . sign ( ) ) , DEFAULT_CHARSET ) ; } catch ( NoSuchAlgorithmException | InvalidKeyException | SignatureException e ) { throw new EncryptionException ( "Unable to sign message: " , e ) ; } }
Signs the message with the private key .