private String sign(String baseString,PrivateKey privateKey){
  try {
    Signature signer=Signature.getInstance(SHA1_WITH_RSA);
    signer.initSign(privateKey);
    signer.update(baseString.getBytes(UTF_8));
    return DatatypeConverter.printBase64Binary(signer.sign());
  }
 catch (  InvalidKeyException e) {
    throw new MCApiRuntimeException(e);
  }
catch (  SignatureException e) {
    throw new MCApiRuntimeException(e);
  }
catch (  UnsupportedEncodingException e) {
    throw new MCApiRuntimeException(e);
  }
catch (  NoSuchAlgorithmException e) {
    throw new MCApiRuntimeException(e);
  }
}

private String sign ( String baseString , PrivateKey privateKey ) { try { Signature signer = Signature . getInstance ( SHA1_WITH_RSA ) ; signer . initSign ( privateKey ) ; signer . update ( baseString . getBytes ( UTF_8 ) ) ; return DatatypeConverter . printBase64Binary ( signer . sign ( ) ) ; } catch ( InvalidKeyException e ) { throw new MCApiRuntimeException ( e ) ; } catch ( SignatureException e ) { throw new MCApiRuntimeException ( e ) ; } catch ( UnsupportedEncodingException e ) { throw new MCApiRuntimeException ( e ) ; } catch ( NoSuchAlgorithmException e ) { throw new MCApiRuntimeException ( e ) ; } }
method to sign the signature base string .
