400 error when inserting SMimeInfo
See original GitHub issueHello - I’m having some trouble updating S/MIME for a user via the .NET SDK for Gmail, every attempt results in a 400 Bad Request response. I’m attempting to implement this from PowerShell as part of my module, PSGSuite, but have not had much luck with this particular API. Issue tracking this in that repo: https://github.com/scrthq/PSGSuite/issues/57
Checking through the documentation and source code for various SDK languages as well as the REST API itself isn’t too helpful, as it appears the .NET SDK is the only language that is expecting a String
type for the Pkcs12
property on the SmimeInfo
body object, everything else expects the certificate bytes. Attempting to pass in the byte array works, but implicitly casts it to a single string, which results in a 400 Bad Request. I’ve also attempted to convert to both Base64 and URLSafeBase64, those fail with the same 400 error.
Should the Pkcs12
property on the SMimeInfo
object be expecting a Byte[]
type instead of String
? Is there something I’m doing wrong here?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11
Top GitHub Comments
Right, I’ve now consulted with a colleague, and we agree that the URL-safe encoding (without trimming) is likely to work. That would match other behavior in the gmail API which is documented, e.g. here for the “raw” field: https://developers.google.com/gmail/api/v1/reference/users/messages#resource
If you could confirm that it works for you when you’re able to do so, we can try to get the documentation amended to make it clear using the same wording as for Message.raw. Thanks!
Maybe - all the reference documentation is auto-generated, so I’ll need to work out how to phrase it properly in a cross-platform way.