[go-nuts] Re: Help ASCII armor PGP Messages with golang.org/x/crypto/openpgp

2021-03-01 Thread Brian Candler
The panic is in line 67, when you were decrypting the private key.  However 
you provided a public key (see line 131).

These things are always obvious to a fresh pair of eyes :-)

In short, you need to provide *Roger's public key* and *Roger's private key* 
respectively.  The public key is used to encrypt the message, and the 
corresponding private key is used to decrypt the message.

Alice's key is *not needed at all*.

On Monday, 1 March 2021 at 05:48:35 UTC Hugo3 wrote:

> https://play.golang.org/p/XhnDZwJYdLp
>
> On Sunday, February 28, 2021 at 10:57:21 PM UTC-5 Hugo3 wrote:
>
>> I used 2 test keys using the key block for Alice as the public key and 
>> Roger as the private key. but receiving a panic error: panic: runtime 
>> error: invalid memory address or nil pointer dereference
>> [signal SIGSEGV: segmentation violation code=0x1 addr=0x128 pc=0x51fdd7]
>>
>> On Sunday, February 28, 2021 at 3:37:01 AM UTC-5 Brian Candler wrote:
>>
>>> Your program does that already, so I'm not sure what the problem is.
>>>
>>> Note that you don't need the private key to encode.  Your function 
>>> encryptMessage() makes no use of the arguments privateKey, 
>>> privateKeyPassword - you can simply remove them.
>>> https://play.golang.org/p/EbuCRR32C7d
>>>
>>> Now it's clearer that encryptMessage() uses the public key only, and 
>>> decryptMessage() uses the private key only.
>>>
>>> Therefore, Alice needs only Roger's public key to encrypt.  She doesn't 
>>> need Roger's private key, nor her own private key unless she wants to sign 
>>> the message.
>>>
>>> Roger needs only Roger's private key to decrypt.  If the message was 
>>> signed by Alice's private key, he would need Alice's public key to verify 
>>> the signature.
>>>
>>> On Sunday, 28 February 2021 at 03:02:59 UTC Hugo3 wrote:
>>>
 https://play.golang.org/p/HpXdDlKcOPt


 This is an example what I want to do is return a encrypted message from 
 Alice
 that can only be read by decrypted with Rogers key to reveal a 
 sensitive message. 




-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d667e5b2-6225-44e4-8b09-b21395caa1bcn%40googlegroups.com.


[go-nuts] Re: Help ASCII armor PGP Messages with golang.org/x/crypto/openpgp

2021-02-28 Thread Hugo3
https://play.golang.org/p/XhnDZwJYdLp

On Sunday, February 28, 2021 at 10:57:21 PM UTC-5 Hugo3 wrote:

> I used 2 test keys using the key block for Alice as the public key and 
> Roger as the private key. but receiving a panic error: panic: runtime 
> error: invalid memory address or nil pointer dereference
> [signal SIGSEGV: segmentation violation code=0x1 addr=0x128 pc=0x51fdd7]
>
> On Sunday, February 28, 2021 at 3:37:01 AM UTC-5 Brian Candler wrote:
>
>> Your program does that already, so I'm not sure what the problem is.
>>
>> Note that you don't need the private key to encode.  Your function 
>> encryptMessage() makes no use of the arguments privateKey, 
>> privateKeyPassword - you can simply remove them.
>> https://play.golang.org/p/EbuCRR32C7d
>>
>> Now it's clearer that encryptMessage() uses the public key only, and 
>> decryptMessage() uses the private key only.
>>
>> Therefore, Alice needs only Roger's public key to encrypt.  She doesn't 
>> need Roger's private key, nor her own private key unless she wants to sign 
>> the message.
>>
>> Roger needs only Roger's private key to decrypt.  If the message was 
>> signed by Alice's private key, he would need Alice's public key to verify 
>> the signature.
>>
>> On Sunday, 28 February 2021 at 03:02:59 UTC Hugo3 wrote:
>>
>>> https://play.golang.org/p/HpXdDlKcOPt
>>>
>>>
>>> This is an example what I want to do is return a encrypted message from 
>>> Alice
>>> that can only be read by decrypted with Rogers key to reveal a sensitive 
>>> message. 
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/fa37fad6-3a97-47e4-a544-b1aa0e49959dn%40googlegroups.com.


[go-nuts] Re: Help ASCII armor PGP Messages with golang.org/x/crypto/openpgp

2021-02-28 Thread Hugo3
I used 2 test keys using the key block for Alice as the public key and 
Roger as the private key. but receiving a panic error: panic: runtime 
error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x128 pc=0x51fdd7]

On Sunday, February 28, 2021 at 3:37:01 AM UTC-5 Brian Candler wrote:

> Your program does that already, so I'm not sure what the problem is.
>
> Note that you don't need the private key to encode.  Your function 
> encryptMessage() makes no use of the arguments privateKey, 
> privateKeyPassword - you can simply remove them.
> https://play.golang.org/p/EbuCRR32C7d
>
> Now it's clearer that encryptMessage() uses the public key only, and 
> decryptMessage() uses the private key only.
>
> Therefore, Alice needs only Roger's public key to encrypt.  She doesn't 
> need Roger's private key, nor her own private key unless she wants to sign 
> the message.
>
> Roger needs only Roger's private key to decrypt.  If the message was 
> signed by Alice's private key, he would need Alice's public key to verify 
> the signature.
>
> On Sunday, 28 February 2021 at 03:02:59 UTC Hugo3 wrote:
>
>> https://play.golang.org/p/HpXdDlKcOPt
>>
>>
>> This is an example what I want to do is return a encrypted message from 
>> Alice
>> that can only be read by decrypted with Rogers key to reveal a sensitive 
>> message. 
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/56797c61-e454-4ed6-9d1c-ae929305b8een%40googlegroups.com.


[go-nuts] Re: Help ASCII armor PGP Messages with golang.org/x/crypto/openpgp

2021-02-28 Thread Brian Candler
Your program does that already, so I'm not sure what the problem is.

Note that you don't need the private key to encode.  Your function 
encryptMessage() makes no use of the arguments privateKey, 
privateKeyPassword - you can simply remove them.
https://play.golang.org/p/EbuCRR32C7d

Now it's clearer that encryptMessage() uses the public key only, and 
decryptMessage() uses the private key only.

Therefore, Alice needs only Roger's public key to encrypt.  She doesn't 
need Roger's private key, nor her own private key unless she wants to sign 
the message.

Roger needs only Roger's private key to decrypt.  If the message was signed 
by Alice's private key, he would need Alice's public key to verify the 
signature.

On Sunday, 28 February 2021 at 03:02:59 UTC Hugo3 wrote:

> https://play.golang.org/p/HpXdDlKcOPt
>
>
> This is an example what I want to do is return a encrypted message from 
> Alice
> that can only be read by decrypted with Rogers key to reveal a sensitive 
> message. 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4fa79506-4dd6-4aa7-8acf-6e33b20bd830n%40googlegroups.com.