I'm trying to encrypt a url-request, username and password, then post it to a webpage.
But for some reason eclipse is saying the syntax is wrong, what am I doing wrong?
It is the bit at the bottom where it says md.update that is causing errors.
Here's my code so far:
private static final String apiKey = "38m8nyev284nddci49940303094";
private static final String apiUser = "esdt34ds";
long unixTimeStamp = System.currentTimeMillis() / 1000L;
String newFeedRequest = "1.0/evoStructure?timestamp=" + unixTimeStamp;
String fixturesFeedURL = "https://secure.website.com/_services/api/" + newFeedRequest;
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(fixturesFeedURL.getBytes("UTF-8"),apiKey.getBytes("UTF-8"),apiUser.getBytes("UTF-8")); // Change this to "UTF-16" if needed
byte[] digest = md.digest();
Here is the error I am getting:
Multiple markers at this line
- Syntax error, insert "Type VariableDeclaratorId" to complete FormalParameterList
- Syntax error on token "update", Identifier expected after this token
- Syntax error on tokens, AnnotationName expected instead
- Syntax error on token ",", @ expected
- Syntax error on token ",", @ expected