|
|
@ -250,6 +250,7 @@ public class AgentUtilOperations {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String prepareSecurePayLoad(String message) throws AgentCoreOperationException {
|
|
|
|
public static String prepareSecurePayLoad(String message) throws AgentCoreOperationException {
|
|
|
|
|
|
|
|
if (EnrollmentManager.getInstance().isEnrolled()) {
|
|
|
|
PrivateKey devicePrivateKey = EnrollmentManager.getInstance().getPrivateKey();
|
|
|
|
PrivateKey devicePrivateKey = EnrollmentManager.getInstance().getPrivateKey();
|
|
|
|
String encodedMessage = Base64.encodeBase64String(message.getBytes());
|
|
|
|
String encodedMessage = Base64.encodeBase64String(message.getBytes());
|
|
|
|
String signedPayload;
|
|
|
|
String signedPayload;
|
|
|
@ -267,9 +268,13 @@ public class AgentUtilOperations {
|
|
|
|
//below statements are temporary fix.
|
|
|
|
//below statements are temporary fix.
|
|
|
|
jsonPayload.put(JSON_SERIAL_KEY, EnrollmentManager.getInstance().getSCEPCertificate().getSerialNumber());
|
|
|
|
jsonPayload.put(JSON_SERIAL_KEY, EnrollmentManager.getInstance().getSCEPCertificate().getSerialNumber());
|
|
|
|
return jsonPayload.toString();
|
|
|
|
return jsonPayload.toString();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return message;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String extractMessageFromPayload(String message) throws AgentCoreOperationException {
|
|
|
|
public static String extractMessageFromPayload(String message) throws AgentCoreOperationException {
|
|
|
|
|
|
|
|
if (EnrollmentManager.getInstance().isEnrolled()) {
|
|
|
|
String actualMessage;
|
|
|
|
String actualMessage;
|
|
|
|
|
|
|
|
|
|
|
|
PublicKey serverPublicKey = EnrollmentManager.getInstance().getServerPublicKey();
|
|
|
|
PublicKey serverPublicKey = EnrollmentManager.getInstance().getServerPublicKey();
|
|
|
@ -301,6 +306,9 @@ public class AgentUtilOperations {
|
|
|
|
throw new AgentCoreOperationException(errorMsg);
|
|
|
|
throw new AgentCoreOperationException(errorMsg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return actualMessage;
|
|
|
|
return actualMessage;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return message;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static String getAuthenticationMethod() {
|
|
|
|
public static String getAuthenticationMethod() {
|
|
|
|