Skip to content

Commit

Permalink
Add workaround for iOS 11 broken Base64 encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carson Farrell authored and seize-the-dave committed Dec 14, 2017
1 parent 40295aa commit fee2a56
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/org/jscep/server/ScepServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,20 @@ private byte[] getMessageBytes(final HttpServletRequest req)
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Decoding {}", msg);
}
return Base64.decode(msg);
return Base64.decode(fixBrokenBase64(msg));
} else {
return new byte[0];
}
}
}

/**
* iOS 11's MDM sends badly encoded Base64 data, with '+' encoded as ' '.
*
* @return the base64 string with ' ' replaced by '+'.
*/
private String fixBrokenBase64(String base64) {
return base64.replace(' ', '+');
}

}

0 comments on commit fee2a56

Please sign in to comment.