public byte[] sign(final String text) throws DataSigningException {
  try {
    final Signature signature=Signature.getInstance("SHA256withRSA");
    signature.initSign(getPrivateKey());
    signature.update(text.getBytes("UTF-8"));
    return signature.sign();
  }
 catch (  final NoSuchAlgorithmException e) {
    throw new DataSigningException(e);
  }
catch (  final UnrecoverableKeyException e) {
    throw new DataSigningException(e);
  }
catch (  final InvalidKeyException e) {
    throw new DataSigningException(e);
  }
catch (  final SignatureException e) {
    throw new DataSigningException(e);
  }
catch (  final UnsupportedEncodingException e) {
    throw new DataSigningException(e);
  }
catch (  final KeyStoreException e) {
    throw new DataSigningException(e);
  }
}

public byte [ ] sign ( final String text ) throws DataSigningException { try { final Signature signature = Signature . getInstance ( "SHA256withRSA" ) ; signature . initSign ( getPrivateKey ( ) ) ; signature . update ( text . getBytes ( "UTF-8" ) ) ; return signature . sign ( ) ; } catch ( final NoSuchAlgorithmException e ) { throw new DataSigningException ( e ) ; } catch ( final UnrecoverableKeyException e ) { throw new DataSigningException ( e ) ; } catch ( final InvalidKeyException e ) { throw new DataSigningException ( e ) ; } catch ( final SignatureException e ) { throw new DataSigningException ( e ) ; } catch ( final UnsupportedEncodingException e ) { throw new DataSigningException ( e ) ; } catch ( final KeyStoreException e ) { throw new DataSigningException ( e ) ; } }
sign provided text with sha256withrsa initialized by the private key
