micromdm / nanomdm

NanoMDM is a minimalist Apple MDM server and library heavily inspired by MicroMDM
MIT License
224 stars 44 forks source link

private key PEM appears to be encrypted #106

Closed JieAnthony closed 8 months ago

JieAnthony commented 8 months ago

I uploaded my APNs certificate and PushCertificatePrivateKey.key file to /v1/pushcert, why did this error occur? I followed the requirements of micromdm to generate the files. What's the problem? @jessepeterson

JieAnthony commented 8 months ago

@jessepeterson Sorry to bother you, but this issue is indeed urgent. hope you can help me

JieAnthony commented 8 months ago

The push cert API endpoint allows for uploading an APNS push certificate. It takes a concatenated PEM-encoded APNs push certificate and private key as its HTTP body. Note the private key should not be encrypted. A quick way to utilize this endpoint is to usecurl. For example:

In micromdm, the -password option is required for both vendor creation and push, which prevents me from creating files that do not require encryption. @jessepeterson

JieAnthony commented 8 months ago
APNs.pem 
PushCertificatePrivateKey.key 
PushCertificateRequest.plist 
VendorPrivateKey.key
mdm.cer
PushCertificateRequest.csr
VendorCertificateRequest.csr

This is the file I generated using micromdm and following mdmctl mdmcert. Can successfully download mdm.cer and push.pem at nanomdm upload APNs certificate and private key fail

korylprince commented 8 months ago

openssl rsa -in PushCertificatePrivateKey.key -out key.pem will export the key to key.pem without the password (the command will prompt you for the existing password).

JieAnthony commented 8 months ago

@korylprince Thank you!