SCRT-HQ / PSGSuite

Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
https://psgsuite.io/
Apache License 2.0
235 stars 67 forks source link

[Issue] Creating S/MIME Certificates fails with 400 Bad Request #57

Open jtwaddle opened 6 years ago

jtwaddle commented 6 years ago

Add support for managing a users S/MIME Certificates https://developers.google.com/gmail/api/guides/smime_certs

scrthq commented 6 years ago

Thanks, @jtwaddle !

scrthq commented 6 years ago

Working on this still @jtwaddle - Once I have this ready, I may need some testing feedback from you since my personal domain doesn't have S/MIME (G Suite Business) and my org uses an external solution for handling email encryption, so no dice there either lol.

I'll keep you updated here though!

scrthq commented 6 years ago

Branch created for this feature request: https://github.com/scrthq/PSGSuite/tree/feature/SMIME_support_issue57

scrthq commented 6 years ago

hey @jtwaddle - S/MIMEInfo functions have been added in as of v2.11.0! I don't have an Enterprise subscription with S/MIME enabled, so I'm not 100% comfortable that New-GSGmailSMIMEInfo is going to format the cert correctly. When you get a chance, can you let me know if all is well?

jtwaddle commented 6 years ago

Thank you! I will test it out next week!

Thanks again!

On Thu, Jul 5, 2018, 9:05 PM Nate Ferrell notifications@github.com wrote:

hey @jtwaddle https://github.com/jtwaddle - S/MIMEInfo functions have been added in as of v2.11.0! I don't have an Enterprise subscription with S/MIME enabled, so I'm not 100% comfortable that New-GSGmailSMIMEInfo is going to format the cert correctly. When you get a chance, can you let me know if all is well?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-402919571, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXiF9mPN94rFtn2RNgQERoymkS2s0ks5uDuH8gaJpZM4UmVZu .

scrthq commented 6 years ago

Sounds good! Looking forward to your feedback, have a great weekend!

jtwaddle commented 6 years ago

Initial Testing: Get-GSGmailSMIMEInfo - appears to function as expected.

New-GSGmailSMIMEInfo: I am getting an error when trying to run it. The cert and password work fine when I add it via the GUI. New-GSGmailSMIMEInfo -User 'me@zoo.com' -SendAsEmail 'me@zoo.com' -Pkcs12 "D:\gmailcertzoo.pfx" -EncryptedKeyPassword $SecurePassword New-GSGmailSMIMEInfo : Exception calling "Execute" with "0" argument(s): "Google.Apis.Requests.RequestError Bad Request [400] Errors [ Message[Bad Request] Location[ - ] Reason[invalidArgument] Domain[global] ] " At line:1 char:1

jtwaddle commented 6 years ago

The issue looks related to these lines:

EncryptedKeyPassword { $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $p12String = Convert-Base64 -From NormalString -To WebSafeBase64String -String "$([System.IO.File]::ReadAllText((Resolve-Path $PSBoundParameters[$key]).Path))" $body.$key = $p12String }

It looks like you need to set these to two different values instead of both to $body.$key make them both part of a smimeInfo object which I assume is $body.

scrthq commented 6 years ago

so, the $key in $body.$key is referring to the current PSBoundParameter in the foreach statement, super normal and a common pattern throughout the rest of PSGSuite.

It's either bad formatting on the EncryptedKeyPassword (i.e. Google is expecting a Base64 encoded string not a plain text string) and/or bad formatting on the P12Key... Google's documentation isn't super clear on it and there are discrepancies between what their Rest API docs say, what Python examples are doing, and what their .NET SDK docs say, so it's a bit of a mixed bag :-(.

Do you have another non-password protected key to test with, by chance, that way we can at least eliminate one variable and focus solely on whether the key itself is parsed into the bodycorrectly?

On Tue, Jul 10, 2018 at 4:54 PM jtwaddle notifications@github.com wrote:

The issue looks related to these lines:

EncryptedKeyPassword { $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $p12String = Convert-Base64 -From NormalString -To WebSafeBase64String -String "$([System.IO.File]::ReadAllText((Resolve-Path $PSBoundParameters[$key]).Path))" $body.$key = $p12String }

It looks like you need to set these to two different values instead of both to $body.$key make them both part of a smimeInfo object which I assume is $body.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-403978458, or mute the thread https://github.com/notifications/unsubscribe-auth/AMIo3cNyh4Z4Y1OJjCoU7ZKZVePnaW7bks5uFSKigaJpZM4UmVZu .

jtwaddle commented 6 years ago

I will give it a try. I did use the same certificate and password in the Gmail UI and it added just fine so there shouldn't be any issue with them

Jessie

On Thu, Jul 12, 2018, 10:34 AM Nate Ferrell notifications@github.com wrote:

so, the $key in $body.$key is referring to the current PSBoundParameter in the foreach statement, super normal and a common pattern throughout the rest of PSGSuite.

It's either bad formatting on the EncryptedKeyPassword (i.e. Google is expecting a Base64 encoded string not a plain text string) and/or bad formatting on the P12Key... Google's documentation isn't super clear on it and there are discrepancies between what their Rest API docs say, what Python examples are doing, and what their .NET SDK docs say, so it's a bit of a mixed bag :-(.

Do you have another non-password protected key to test with, by chance, that way we can at least eliminate one variable and focus solely on whether the key itself is parsed into the bodycorrectly?

On Tue, Jul 10, 2018 at 4:54 PM jtwaddle notifications@github.com wrote:

The issue looks related to these lines:

EncryptedKeyPassword { $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $p12String = Convert-Base64 -From NormalString -To WebSafeBase64String -String "$([System.IO.File]::ReadAllText((Resolve-Path $PSBoundParameters[$key]).Path))" $body.$key = $p12String }

It looks like you need to set these to two different values instead of both to $body.$key make them both part of a smimeInfo object which I assume is $body.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-403978458, or mute the thread < https://github.com/notifications/unsubscribe-auth/AMIo3cNyh4Z4Y1OJjCoU7ZKZVePnaW7bks5uFSKigaJpZM4UmVZu

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-404554443, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXvFx52ahq7W0bhfoUJUCBJDnRNOLks5uF2yagaJpZM4UmVZu .

scrthq commented 6 years ago

@jtwaddle - I have some ideas on how to adjust that block below. If you could swap that out, reimport the module with the -Force parameter, then try, that would be awesome!

I have no doubt that the cert and password you're supplying are correct and valid, this is a conversion issue within the function.

I re-opened this issue for tracking so it doesn't get buried =]

EncryptedKeyPassword {
    $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password
}
Pkcs12 {
    $p12String = Convert-Base64 -From Base64String -To WebSafeBase64String -String ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path)))
    $body.$key = $p12String
}
jtwaddle commented 6 years ago

Thank you for clarifying. I will test it out!

Jessie

On Fri, Jul 13, 2018 at 12:27 AM Nate Ferrell notifications@github.com wrote:

@jtwaddle https://github.com/jtwaddle - I have some ideas on how to adjust that block below. If you could swap that out, reimport the module with the -Force parameter, then try, that would be awesome!

I have no doubt that the cert and password you're supplying are correct and valid, this is a conversion issue within the function.

I re-opened this issue for tracking so it doesn't get buried =]

EncryptedKeyPassword { $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $p12String = Convert-Base64 -From Base64String -To WebSafeBase64String -String ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path))) $body.$key = $p12String }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-404729388, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXm_aIUUjHemPBPxMwRcITHHf5thMks5uGC-0gaJpZM4UmVZu .

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

jtwaddle commented 6 years ago

I got the same error with this code change.

On Fri, Jul 13, 2018 at 3:25 PM Jessie Twaddle jtwaddle@gmail.com wrote:

Thank you for clarifying. I will test it out!

Jessie

On Fri, Jul 13, 2018 at 12:27 AM Nate Ferrell notifications@github.com wrote:

@jtwaddle https://github.com/jtwaddle - I have some ideas on how to adjust that block below. If you could swap that out, reimport the module with the -Force parameter, then try, that would be awesome!

I have no doubt that the cert and password you're supplying are correct and valid, this is a conversion issue within the function.

I re-opened this issue for tracking so it doesn't get buried =]

EncryptedKeyPassword { $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $p12String = Convert-Base64 -From Base64String -To WebSafeBase64String -String ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path))) $body.$key = $p12String }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-404729388, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXm_aIUUjHemPBPxMwRcITHHf5thMks5uGC-0gaJpZM4UmVZu .

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

jtwaddle commented 6 years ago

Any other ideas of what I could try?

On Sat, Jul 14, 2018, 8:32 AM Jessie Twaddle jtwaddle@gmail.com wrote:

I got the same error with this code change.

On Fri, Jul 13, 2018 at 3:25 PM Jessie Twaddle jtwaddle@gmail.com wrote:

Thank you for clarifying. I will test it out!

Jessie

On Fri, Jul 13, 2018 at 12:27 AM Nate Ferrell notifications@github.com wrote:

@jtwaddle https://github.com/jtwaddle - I have some ideas on how to adjust that block below. If you could swap that out, reimport the module with the -Force parameter, then try, that would be awesome!

I have no doubt that the cert and password you're supplying are correct and valid, this is a conversion issue within the function.

I re-opened this issue for tracking so it doesn't get buried =]

EncryptedKeyPassword { $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $p12String = Convert-Base64 -From Base64String -To WebSafeBase64String -String ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path))) $body.$key = $p12String }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-404729388, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXm_aIUUjHemPBPxMwRcITHHf5thMks5uGC-0gaJpZM4UmVZu .

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

scrthq commented 6 years ago

@jtwaddle - Thanks for your help out with testing and your patience on this! Here are a few more options:

1. P12 as Base64 and Password as plain text:

EncryptedKeyPassword {
    $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password
}
Pkcs12 {
    $body.$key = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path))
}

2. P12 as Base64 and Password as Base64:

EncryptedKeyPassword {
    $body.$key = Convert-Base64 -From NormalString -To Base64String -String (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password
}
Pkcs12 {
    $body.$key = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path))
}

3. P12 as WebSafeBase64 and Password as WebSafeBase64:

EncryptedKeyPassword {
    $body.$key = Convert-Base64 -From NormalString -To WebSafeBase64String -String (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password
}
Pkcs12 {
    $body.$key = Convert-Base64 -From Base64String -To WebSafeBase64String -String ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path)))
}

Let me know if any of these get you going!

jtwaddle commented 6 years ago

Thank you for sending some more to try. I did not have any luck with any of these 3 options.

Do you have any more ideas?

On Sat, Jul 21, 2018 at 12:13 PM Nate Ferrell notifications@github.com wrote:

@jtwaddle https://github.com/jtwaddle - Thanks for your help out with testing and your patience on this! Here are a few more options:

  1. P12 as Base64 and Password as plain text:

EncryptedKeyPassword { $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $body.$key = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path)) }

  1. P12 as Base64 and Password as Base64:

EncryptedKeyPassword { $body.$key = Convert-Base64 -From NormalString -To Base64String -String (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $body.$key = [System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path)) }

  1. P12 as WebSafeBase64 and Password as WebSafeBase64:

EncryptedKeyPassword { $body.$key = Convert-Base64 -From NormalString -To WebSafeBase64String -String (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $body.$key = Convert-Base64 -From Base64String -To WebSafeBase64String -String ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path))) }


Let me know if any of these get you going!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-406810573, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXq3fqtig_pWs9L5RkImUfn_w5mdcks5uI2FHgaJpZM4UmVZu .

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

scrthq commented 6 years ago

Seeing if I can get Google to give me a test domain with Enterprise licensing so I can test on my end. I don't have any other suggestions off hand right now though 😞 I'll keep you updated!

jtwaddle commented 6 years ago

Did you ever have any luck with this?

On Thu, Aug 2, 2018, 12:45 PM Nate Ferrell notifications@github.com wrote:

Seeing if I can get Google to give me a test domain with Enterprise licensing so I can test on my end. I don't have any other suggestions off hand right now though 😞 I'll keep you updated!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-410010780, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXibE9DRn4E0C3lRyuX6FjMFON3_jks5uMzq5gaJpZM4UmVZu .

scrthq commented 6 years ago

Nothing yet 😢 I've tried a couple different avenues to get access to an Enterprise account so I can test further as well as reached out to their Gmail API support team and have gotten literally nothing useful back 😞

jtwaddle commented 6 years ago

Any other ideas on things I could try?

On Wed, Oct 3, 2018 at 2:34 PM Nate Ferrell notifications@github.com wrote:

Nothing yet 😢 I've tried a couple different avenues to get access to an Enterprise account so I can test further as well as reached out to their Gmail API support team and have gotten literally nothing useful back 😞

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-426769951, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXoMrV0iMm-l3a39g4kLY5V7QUwzvks5uhRFggaJpZM4UmVZu .

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

jtwaddle commented 5 years ago

Any other ideas I could try?

On Thu, Oct 4, 2018, 8:05 AM Jessie Twaddle jtwaddle@gmail.com wrote:

Any other ideas on things I could try?

On Wed, Oct 3, 2018 at 2:34 PM Nate Ferrell notifications@github.com wrote:

Nothing yet 😢 I've tried a couple different avenues to get access to an Enterprise account so I can test further as well as reached out to their Gmail API support team and have gotten literally nothing useful back 😞

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-426769951, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXoMrV0iMm-l3a39g4kLY5V7QUwzvks5uhRFggaJpZM4UmVZu .

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

scrthq commented 5 years ago

hey @jtwaddle - nothing yet, apologies on the delay on this, it's literally been forever and I feel bad 😢. I am going to check out bumping my own account to Enterprise where I can test so I can close this one out, just been a bit slammed.

jtwaddle commented 5 years ago

No problem at all. Thank you for trying!

On Tue, Mar 19, 2019, 6:34 PM Nate Ferrell notifications@github.com wrote:

hey @jtwaddle https://github.com/jtwaddle - nothing yet, apologies on the delay on this, it's literally been forever and I feel bad 😢. I am going to check out bumping my own account to Enterprise where I can test so I can close this one out, just been a bit slammed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-474625236, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXjsjjhRcmiBWl0BIGewqEWDs1jLYks5vYXQUgaJpZM4UmVZu .

scrthq commented 5 years ago

hey @jtwaddle - I updated my own account to Enterprise and have been giving it a few whacks and am at least replicating the issue. Going to try going through the REST API directly instead of the .NET SDK, in case there's an issue with the .NET SDK itself. I should hopefully have some progress on this by this weekend!

Now to find a low-cost cert that Google will allow for S/MIME...

scrthq commented 5 years ago

Sectigo (fka Comodo) actually has some reasonably priced ones that I believe are trusted by Google for S/MIME

jtwaddle commented 5 years ago

They used to offer a free one. I am not sure if they still do.

On Wed, Apr 10, 2019 at 9:17 AM Nate Ferrell notifications@github.com wrote:

Sectigo (fka Comodo) actually has some reasonably priced ones https://sectigo.com/products/signing-certificates/email-smime-certificate that I believe are trusted by Google for S/MIME https://support.google.com/a/answer/7448393?hl=en

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-481709819, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXm1eB5RhI8OQvgK9TpLhS0qFJmofks5vffJcgaJpZM4UmVZu .

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

scrthq commented 5 years ago

Doesn't appear so (but will confirm with their support for sure). Google search still turns up results that point at https://www.comodo.com/home/email-security/free-email-certificate.php, but going to that link takes you to the page linked in my last comment and searching for the word "free" in the page contents doesn't yield anything, so my guess is Google cached search results still showing =\

scrthq commented 5 years ago

This may work potentially: https://sectigo.com/ssl-certificates/free-trial

jtwaddle commented 5 years ago

Any luck with this?

Thank you!

On Wed, Apr 10, 2019, 10:24 AM Nate Ferrell notifications@github.com wrote:

This may work potentially: https://sectigo.com/ssl-certificates/free-trial

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-481737667, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXqUmztVngW2UQkB0xXIFJbvlgNnKks5vfgJEgaJpZM4UmVZu .

scrthq commented 5 years ago

Hey @jtwaddle - I've been on vacation but should hopefully be jumping on this again by the weekend!

jtwaddle commented 5 years ago

Any luck on this one?

On Fri, Jul 20, 2018 at 5:44 PM Jessie Twaddle jtwaddle@gmail.com wrote:

Any other ideas of what I could try?

On Sat, Jul 14, 2018, 8:32 AM Jessie Twaddle jtwaddle@gmail.com wrote:

I got the same error with this code change.

On Fri, Jul 13, 2018 at 3:25 PM Jessie Twaddle jtwaddle@gmail.com wrote:

Thank you for clarifying. I will test it out!

Jessie

On Fri, Jul 13, 2018 at 12:27 AM Nate Ferrell notifications@github.com wrote:

@jtwaddle https://github.com/jtwaddle - I have some ideas on how to adjust that block below. If you could swap that out, reimport the module with the -Force parameter, then try, that would be awesome!

I have no doubt that the cert and password you're supplying are correct and valid, this is a conversion issue within the function.

I re-opened this issue for tracking so it doesn't get buried =]

EncryptedKeyPassword { $body.$key = (New-Object PSCredential "user",$PSBoundParameters[$key]).GetNetworkCredential().Password } Pkcs12 { $p12String = Convert-Base64 -From Base64String -To WebSafeBase64String -String ([System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes((Resolve-Path $PSBoundParameters[$key]).Path))) $body.$key = $p12String }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/scrthq/PSGSuite/issues/57#issuecomment-404729388, or mute the thread https://github.com/notifications/unsubscribe-auth/AP8uXm_aIUUjHemPBPxMwRcITHHf5thMks5uGC-0gaJpZM4UmVZu .

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

-- Jessie Twaddle jtwaddle@gmail.com

Something to think about....

"Finish each day and be done with it. You have done what you could; some blunders and absurdities have crept in; forget them as soon as you can. Tomorrow is a new day; you shall begin it serenely and with too high a spirit to be encumbered with your old nonsense." -Emerson

scrthq commented 5 years ago

@jtwaddle - still nothing, I need to pick this back up. Thanks for the poke!

scrthq commented 4 years ago

@jtwaddle Opened up https://github.com/googleapis/google-api-dotnet-client/issues/1492 to see if there's an issue with the .NET SDK potentially

scrthq commented 4 years ago

@jtwaddle - Working on the issue in the google-api-dotnet-client repo, but I was doing some code comparison against GAM and was able to replicate the resulting string being sent as the value for Pkcs12 when inserting a new S/MIME object.

v2.35.1 is being deployed now and should be ready to test at your convenience =]

scrthq commented 4 years ago

@jtwaddle - let me know if you've had a chance to test! Working with the Google API Client team and the changes implemented should have it working now. Anxiously awaiting your feedback :D