Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET PKIMessage endpoint returning illegal base64 data at input byte #178

Open
KarthikaRajendran11 opened this issue Sep 21, 2021 · 2 comments

Comments

@KarthikaRajendran11
Copy link

I am trying to implement OTA on a ios device. The device sends /GetCACert and /GetCACaps request successfully. In the third step, when the device send operation=PKIOperation\u0026message=MIAGCSq... request, the server returns illegal base64 data at input byte This error is returned specifically at this line :

return base64.StdEncoding.DecodeString(msg2)
I am running the scepserver as a standalone project. I realize this might not be an issue with the server but wanted to confirm once. Would anyone happen to know what the issue might be ?

@jessepeterson
Copy link
Member

Hmm, we definitely have used OTA with SCEP in MicroMDM. But because the GetCACaps tells it that it uses a POST you shouldn't see the message= part on the PKIOperation. Is this a GET or POST request?

@KarthikaRajendran11
Copy link
Author

KarthikaRajendran11 commented Sep 21, 2021

Thanks for the response. It was a GET request. I was able to get a response when I replaced

if op == "PKIOperation" {

with

if op == "PKIOperation" {
	execPath, err := exec.LookPath("base64")
	if err != nil {
		fmt.Println(err.Error())
		return nil, err
	}
	cmd := exec.Command(execPath, "--decode", "/Users/karthikarajendran/Desktop/iphone.txt")
	d, err := cmd.Output()
	if err != nil {
		fmt.Println(err.Error())
		return nil, err
	}
	msg = string(d)
}

And this how the endpoint was called from Postman
http://localhost:8080/scep?operation=PKIOperation&message=MIAGCSqGSIb... iPhone logs showed the same call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants