Skip to contentSkip to conversation

tpm2 Digest, Vol 21, Issue 2

tpm2 Desai 2 participants 7 messages Mar 5, 2019 – Mar 13, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Desai

#1 lore raw

+1 to what Bill said. If you must do this I'd suggest you use createprimary to create the key under endorsement hierarchy. I understand that is exactly what tpm2_createek does but there is a caveat. For what you intend to do it requires userwith attribute set to 1. The reason it is not set to 1 in createek tool is because it would create an endorsement key off a non standard template per TCK EK credential profile spec. The alternative is to satisfy policysecret of the endorsement hierarchy and that will require a change in the tool.

On 3/5/19, 1:00 PM, "tpm2 on behalf of tpm2-request(a)lists.01.org" <tpm2-bounces(a)lists.01.org on behalf of tpm2-request(a)lists.01.org> wrote:

Send tpm2 mailing list submissions to
tpm2(a)lists.01.org

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/tpm2
or, via email, send a message with subject or body 'help' to
tpm2-request(a)lists.01.org

You can reach the person managing the list at
tpm2-owner(a)lists.01.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of tpm2 digest..."

Today's Topics:

1. Re: Use endorsement key for encryption and decryption (Roberts, William C)

----------------------------------------------------------------------

Message: 1
Date: Tue, 5 Mar 2019 17:29:10 +0000
From: "Roberts, William C" <william.c.roberts(a)intel.com>
To: arjun kashyap <arjun21k(a)gmail.com>, "tpm2(a)lists.01.org"
<tpm2(a)lists.01.org>
Subject: Re: [tpm2] Use endorsement key for encryption and decryption Message-ID:
<476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.corp.intel.com>

Content-Type: text/plain; charset="utf-8"

> -----Original Message-----
> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org] On Behalf Of arjun kashyap > Sent: Sunday, March 3, 2019 12:58 PM
> To: tpm2(a)lists.01.org
> Subject: [tpm2] Use endorsement key for encryption and decryption
>
> Hello all,
>
> I am using the IBM tpm2.0 simulator. My use case is that I would like to encrypt > data and send to tpm and then decrypt this at the tpm side. I would want to use > the endorsement key (EK) for this purpose. Hence, I would like to encrypt data > using EK's public key and decrypt using EK's private key. I tried creating EK using > tpm2_createek -G rsa -f pem -c - -p ek.pem. Now, I have the ek.pem( public > portion of EK) to encrypt the data. When I load this key into the tpm and invoke > tpm2_rsadecrypt I get an error. I also tried using tpm2_createprimary to create > an EK but failed in the above attempt. Could anyone please help me out so that I > can use EK to encrypt/decrypt data.
>
> Please let me know if more information is needed.

What's the error code? You probably can't perform an rsadecrypt, Do to object attributes. I would bet sign would work. Endorsement usually means signing.

>
> Thanks in advance.
>
> <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig-
> email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig- > email&utm_content=webmail&utm_term=link>

------------------------------

Subject: Digest Footer

_______________________________________________
tpm2 mailing list
tpm2(a)lists.01.org
https://lists.01.org/mailman/listinfo/tpm2

------------------------------

End of tpm2 Digest, Vol 21, Issue 2
***********************************

#2 lore raw

For what you want to do, try this.

tpm2_createprimary -a e -G rsa -A "fixedtpm|fixedparent|sensitivedataorigin|userwithauth|adminwithpolicy|decrypt" -o key.ctx tpm2_evictcontrol -a o -c key.ctx -p 0x81010002
tpm2_rsaencrypt -c 0x81010002 -o enc.out plain.txt
tpm2_rsadecrypt -c 0x81010002 -o dec.out -I enc.out

PS: I would not use such a key if I cared about privacy.

On 3/5/19, 1:50 PM, "Desai, Imran" <imran.desai(a)intel.com> wrote:

+1 to what Bill said. If you must do this I'd suggest you use createprimary to create the key under endorsement hierarchy. I understand that is exactly what tpm2_createek does but there is a caveat. For what you intend to do it requires userwith attribute set to 1. The reason it is not set to 1 in createek tool is because it would create an endorsement key off a non standard template per TCK EK credential profile spec. The alternative is to satisfy policysecret of the endorsement hierarchy and that will require a change in the tool.

On 3/5/19, 1:00 PM, "tpm2 on behalf of tpm2-request(a)lists.01.org" <tpm2-bounces(a)lists.01.org on behalf of tpm2-request(a)lists.01.org> wrote:

Send tpm2 mailing list submissions to
tpm2(a)lists.01.org

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/tpm2
or, via email, send a message with subject or body 'help' to
tpm2-request(a)lists.01.org

You can reach the person managing the list at
tpm2-owner(a)lists.01.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of tpm2 digest..."

Today's Topics:

1. Re: Use endorsement key for encryption and decryption (Roberts, William C)

----------------------------------------------------------------------

Message: 1
Date: Tue, 5 Mar 2019 17:29:10 +0000
From: "Roberts, William C" <william.c.roberts(a)intel.com>
To: arjun kashyap <arjun21k(a)gmail.com>, "tpm2(a)lists.01.org"
<tpm2(a)lists.01.org>
Subject: Re: [tpm2] Use endorsement key for encryption and decryption Message-ID:
<476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.corp.intel.com>

Content-Type: text/plain; charset="utf-8"

> -----Original Message-----
> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org] On Behalf Of arjun kashyap > Sent: Sunday, March 3, 2019 12:58 PM
> To: tpm2(a)lists.01.org
> Subject: [tpm2] Use endorsement key for encryption and decryption
>
> Hello all,
>
> I am using the IBM tpm2.0 simulator. My use case is that I would like to encrypt > data and send to tpm and then decrypt this at the tpm side. I would want to use > the endorsement key (EK) for this purpose. Hence, I would like to encrypt data > using EK's public key and decrypt using EK's private key. I tried creating EK using > tpm2_createek -G rsa -f pem -c - -p ek.pem. Now, I have the ek.pem( public > portion of EK) to encrypt the data. When I load this key into the tpm and invoke > tpm2_rsadecrypt I get an error. I also tried using tpm2_createprimary to create > an EK but failed in the above attempt. Could anyone please help me out so that I > can use EK to encrypt/decrypt data.
>
> Please let me know if more information is needed.

What's the error code? You probably can't perform an rsadecrypt, Do to object attributes. I would bet sign would work. Endorsement usually means signing.

>
> Thanks in advance.
>
> <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig-
> email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig- > email&utm_content=webmail&utm_term=link>

------------------------------

Subject: Digest Footer

_______________________________________________
tpm2 mailing list
tpm2(a)lists.01.org
https://lists.01.org/mailman/listinfo/tpm2

------------------------------

End of tpm2 Digest, Vol 21, Issue 2
***********************************

#3 lore raw

Thanks William and Imran for your inputs. My use case is that once my system boots up (with tpm) I should be able to send encrypted data to it over the network. I thought I could use the EK as each tpm has a unique and built-in one. My thought process was to try to use the EK public portion to encrypt the data and send it over the network to the tpm and then decrypt it using EK private portion. As both of you pointed out that I should set appropriate attributes while creating the key and prefer using tpm2_createprimary instead of tpm2_createek. But I have another concern with this approach. With tpm2_createek I could extract the public key portion of the EK which gets created. But if I use tpm2_createprimary I do not have that option. So could you suggest some workaround? Also, please feel free to suggest another approach for this use case. Kindly correct me if I am wrong as I am new to tpms.

Thanks again,
Arjun

Quoted 126 lines · Imran

For what you want to do, try this.

tpm2_createprimary -a e -G rsa -A "fixedtpm|fixedparent|sensitivedataorigin|userwithauth|adminwithpolicy|decrypt" -o key.ctx
tpm2_evictcontrol -a o -c key.ctx -p 0x81010002
tpm2_rsaencrypt -c 0x81010002 -o enc.out plain.txt
tpm2_rsadecrypt -c 0x81010002 -o dec.out -I enc.out

PS: I would not use such a key if I cared about privacy.

On 3/5/19, 1:50 PM, "Desai, Imran" <imran.desai(a)intel.com> wrote:

+1 to what Bill said. If you must do this I'd suggest you use
createprimary to create the key under endorsement hierarchy. I understand that is exactly what tpm2_createek does but there is a caveat. For what you intend to do it requires userwith attribute set to 1. The reason it is not set to 1 in createek tool is because it would create an endorsement key off a non standard template per TCK EK credential profile spec. The alternative is to satisfy policysecret of the endorsement hierarchy and that will require a change in the tool.

    On 3/5/19, 1:00 PM, "tpm2 on behalf of tpm2-request(a)lists.01.org" <

tpm2-bounces(a)lists.01.org on behalf of tpm2-request(a)lists.01.org> wrote:

Send tpm2 mailing list submissions to
tpm2(a)lists.01.org

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/tpm2
or, via email, send a message with subject or body 'help' to
tpm2-request(a)lists.01.org

You can reach the person managing the list at
tpm2-owner(a)lists.01.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of tpm2 digest..."

Today's Topics:

1. Re: Use endorsement key for encryption and decryption (Roberts, William C)

----------------------------------------------------------------------

        Message: 1
        Date: Tue, 5 Mar 2019 17:29:10 +0000
        From: "Roberts, William C" <william.c.roberts(a)intel.com>
        To: arjun kashyap <arjun21k(a)gmail.com>, "tpm2(a)lists.01.org"
                <tpm2(a)lists.01.org>
        Subject: Re: [tpm2] Use endorsement key for encryption and
decryption
        Message-ID:
                <

476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.corp.intel.com>

Content-Type: text/plain; charset="utf-8"

> -----Original Message-----
> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org] On Behalf Of
arjun kashyap

        > Sent: Sunday, March 3, 2019 12:58 PM
        > To: tpm2(a)lists.01.org
        > Subject: [tpm2] Use endorsement key for encryption and decryption
        >
        > Hello all,
        >
        > I am using the IBM tpm2.0 simulator. My use case is that I would

like to encrypt
> data and send to tpm and then decrypt this at the tpm side. I
would want to use
> the endorsement key (EK) for this purpose. Hence, I would like
to encrypt data
> using EK's public key and decrypt using EK's private key. I
tried creating EK using
> tpm2_createek -G rsa -f pem -c - -p ek.pem. Now, I have the
ek.pem( public
> portion of EK) to encrypt the data. When I load this key into
the tpm and invoke
> tpm2_rsadecrypt I get an error. I also tried using
tpm2_createprimary to create
> an EK but failed in the above attempt. Could anyone please help
me out so that I

        > can use EK to encrypt/decrypt data.
        >
        > Please let me know if more information is needed.

        What's the error code? You probably can't perform an rsadecrypt,
        Do to object attributes. I would bet sign would work. Endorsement
        usually means signing.

        >
        > Thanks in advance.
        >
        >  <https://www.avast.com/sig-
        > email?utm_medium=email&utm_source=link&utm_campaign=sig-
        > email&utm_content=webmail&utm_term=icon>       Virus-free.
        > www.avast.com <https://www.avast.com/sig-
        > email?utm_medium=email&utm_source=link&utm_campaign=sig-
        > email&utm_content=webmail&utm_term=link>


        ------------------------------

        Subject: Digest Footer

        _______________________________________________
        tpm2 mailing list
        tpm2(a)lists.01.org
        https://lists.01.org/mailman/listinfo/tpm2


        ------------------------------

        End of tpm2 Digest, Vol 21, Issue 2
        ***********************************
Quoted 5 lines

_______________________________________________
tpm2 mailing list
tpm2(a)lists.01.org
https://lists.01.org/mailman/listinfo/tpm2

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

#4 lore raw

You could also use the tpm2-tss-engine.
See this test for an example:
https://github.com/tpm2-software/tpm2-tss-engine/blob/master/test/rsadecrypt.sh

Or if you cannot store a key-file on disk, use the above script and combine it with persistent keys from here:
https://github.com/tpm2-software/tpm2-tss-engine/blob/master/test/rsasign_persistent_emptyauth.sh

Cheers,
Andreas

________________________________
From: tpm2 [tpm2-bounces(a)lists.01.org] on behalf of arjun kashyap [arjun21k(a)gmail.com]
Sent: Thursday, March 07, 2019 20:41
To: Desai, Imran; william.c.roberts(a)intel.com; tpm2(a)lists.01.org
Subject: Re: [tpm2] tpm2 Digest, Vol 21, Issue 2

Thanks William and Imran for your inputs. My use case is that once my system boots up (with tpm) I should be able to send encrypted data to it over the network. I thought I could use the EK as each tpm has a unique and built-in one. My thought process was to try to use the EK public portion to encrypt the data and send it over the network to the tpm and then decrypt it using EK private portion. As both of you pointed out that I should set appropriate attributes while creating the key and prefer using tpm2_createprimary instead of tpm2_createek. But I have another concern with this approach. With tpm2_createek I could extract the public key portion of the EK which gets created. But if I use tpm2_createprimary I do not have that option. So could you suggest some workaround? Also, please feel free to suggest another approach for this use case. Kindly correct me if I am wrong as I am new to tpms.

Thanks again,
Arjun

On Tue, Mar 5, 2019 at 3:27 PM Desai, Imran <imran.desai(a)intel.com<mailto:imran.desai(a)intel.com>> wrote:
For what you want to do, try this.

tpm2_createprimary -a e -G rsa -A "fixedtpm|fixedparent|sensitivedataorigin|userwithauth|adminwithpolicy|decrypt" -o key.ctx tpm2_evictcontrol -a o -c key.ctx -p 0x81010002
tpm2_rsaencrypt -c 0x81010002 -o enc.out plain.txt
tpm2_rsadecrypt -c 0x81010002 -o dec.out -I enc.out

PS: I would not use such a key if I cared about privacy.

On 3/5/19, 1:50 PM, "Desai, Imran" <imran.desai(a)intel.com<mailto:imran.desai(a)intel.com>> wrote:

+1 to what Bill said. If you must do this I'd suggest you use createprimary to create the key under endorsement hierarchy. I understand that is exactly what tpm2_createek does but there is a caveat. For what you intend to do it requires userwith attribute set to 1. The reason it is not set to 1 in createek tool is because it would create an endorsement key off a non standard template per TCK EK credential profile spec. The alternative is to satisfy policysecret of the endorsement hierarchy and that will require a change in the tool.

On 3/5/19, 1:00 PM, "tpm2 on behalf of tpm2-request(a)lists.01.org<mailto:tpm2-request(a)lists.01.org>" <tpm2-bounces(a)lists.01.org<mailto:tpm2-bounces(a)lists.01.org> on behalf of tpm2-request(a)lists.01.org<mailto:tpm2-request(a)lists.01.org>> wrote:

Send tpm2 mailing list submissions to
tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/tpm2
or, via email, send a message with subject or body 'help' to
tpm2-request(a)lists.01.org<mailto:tpm2-request(a)lists.01.org>

You can reach the person managing the list at
tpm2-owner(a)lists.01.org<mailto:tpm2-owner(a)lists.01.org>

When replying, please edit your Subject line so it is more specific than "Re: Contents of tpm2 digest..."

Today's Topics:

1. Re: Use endorsement key for encryption and decryption (Roberts, William C)

----------------------------------------------------------------------

Message: 1
Date: Tue, 5 Mar 2019 17:29:10 +0000
From: "Roberts, William C" <william.c.roberts(a)intel.com<mailto:william.c.roberts(a)intel.com>>
To: arjun kashyap <arjun21k(a)gmail.com<mailto:arjun21k(a)gmail.com>>, "tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>"
<tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>>
Subject: Re: [tpm2] Use endorsement key for encryption and decryption
Message-ID:
<476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.corp.intel.com<mailto:476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.corp.intel.com>>

Content-Type: text/plain; charset="utf-8"

> -----Original Message-----
> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org<mailto:tpm2-bounces(a)lists.01.org>] On Behalf Of arjun kashyap > Sent: Sunday, March 3, 2019 12:58 PM
> To: tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>
> Subject: [tpm2] Use endorsement key for encryption and decryption
>
> Hello all,
>
> I am using the IBM tpm2.0 simulator. My use case is that I would like to encrypt
> data and send to tpm and then decrypt this at the tpm side. I would want to use
> the endorsement key (EK) for this purpose. Hence, I would like to encrypt data
> using EK's public key and decrypt using EK's private key. I tried creating EK using
> tpm2_createek -G rsa -f pem -c - -p ek.pem. Now, I have the ek.pem( public
> portion of EK) to encrypt the data. When I load this key into the tpm and invoke
> tpm2_rsadecrypt I get an error. I also tried using tpm2_createprimary to create
> an EK but failed in the above attempt. Could anyone please help me out so that I
> can use EK to encrypt/decrypt data.
>
> Please let me know if more information is needed.

What's the error code? You probably can't perform an rsadecrypt, Do to object attributes. I would bet sign would work. Endorsement usually means signing.

>
> Thanks in advance.
>
> <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig-
> email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com<http://www.avast.com> <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig- > email&utm_content=webmail&utm_term=link>

------------------------------

Subject: Digest Footer

_______________________________________________
tpm2 mailing list tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>
https://lists.01.org/mailman/listinfo/tpm2

------------------------------

End of tpm2 Digest, Vol 21, Issue 2
***********************************

_______________________________________________
tpm2 mailing list
tpm2(a)lists.01.org<mailto:tpm2(a)lists.01.org>
https://lists.01.org/mailman/listinfo/tpm2

[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free. www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>

#5 lore raw

Thanks Andreas. I will check this out.

Best,
Arjun

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Quoted 179 lines · Andreas

You could also use the tpm2-tss-engine.
See this test for an example:

https://github.com/tpm2-software/tpm2-tss-engine/blob/master/test/rsadecrypt.sh

Or if you cannot store a key-file on disk, use the above script and combine it with persistent keys from here:

https://github.com/tpm2-software/tpm2-tss-engine/blob/master/test/rsasign_persistent_emptyauth.sh

Cheers,
Andreas

------------------------------
*From:* tpm2 [tpm2-bounces(a)lists.01.org] on behalf of arjun kashyap [ arjun21k(a)gmail.com]
*Sent:* Thursday, March 07, 2019 20:41
*To:* Desai, Imran; william.c.roberts(a)intel.com; tpm2(a)lists.01.org *Subject:* Re: [tpm2] tpm2 Digest, Vol 21, Issue 2

Thanks William and Imran for your inputs. My use case is that once my system boots up (with tpm) I should be able to send encrypted data to it over the network. I thought I could use the EK as each tpm has a unique and built-in one. My thought process was to try to use the EK public portion to encrypt the data and send it over the network to the tpm and then decrypt it using EK private portion. As both of you pointed out that I should set appropriate attributes while creating the key and prefer using tpm2_createprimary instead of tpm2_createek. But I have another concern with this approach. With tpm2_createek I could extract the public key portion of the EK which gets created. But if I use tpm2_createprimary I do not have that option. So could you suggest some workaround? Also, please feel free to suggest another approach for this use case. Kindly correct me if I am wrong as I am new to tpms.

Thanks again,
Arjun

Quoted 128 lines · Imran

For what you want to do, try this.

tpm2_createprimary -a e -G rsa -A "fixedtpm|fixedparent|sensitivedataorigin|userwithauth|adminwithpolicy|decrypt" -o key.ctx
tpm2_evictcontrol -a o -c key.ctx -p 0x81010002
tpm2_rsaencrypt -c 0x81010002 -o enc.out plain.txt
tpm2_rsadecrypt -c 0x81010002 -o dec.out -I enc.out

PS: I would not use such a key if I cared about privacy.

On 3/5/19, 1:50 PM, "Desai, Imran" <imran.desai(a)intel.com> wrote:

+1 to what Bill said. If you must do this I'd suggest you use
createprimary to create the key under endorsement hierarchy. I understand that is exactly what tpm2_createek does but there is a caveat. For what you intend to do it requires userwith attribute set to 1. The reason it is not set to 1 in createek tool is because it would create an endorsement key off a non standard template per TCK EK credential profile spec. The alternative is to satisfy policysecret of the endorsement hierarchy and that will require a change in the tool.

    On 3/5/19, 1:00 PM, "tpm2 on behalf of tpm2-request(a)lists.01.org" <

tpm2-bounces(a)lists.01.org on behalf of tpm2-request(a)lists.01.org> wrote:

Send tpm2 mailing list submissions to
tpm2(a)lists.01.org

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/tpm2
or, via email, send a message with subject or body 'help' to
tpm2-request(a)lists.01.org

You can reach the person managing the list at
tpm2-owner(a)lists.01.org

When replying, please edit your Subject line so it is more
specific
than "Re: Contents of tpm2 digest..."

Today's Topics:

1. Re: Use endorsement key for encryption and decryption (Roberts, William C)

----------------------------------------------------------------------

        Message: 1
        Date: Tue, 5 Mar 2019 17:29:10 +0000
        From: "Roberts, William C" <william.c.roberts(a)intel.com>
        To: arjun kashyap <arjun21k(a)gmail.com>, "tpm2(a)lists.01.org"
                <tpm2(a)lists.01.org>
        Subject: Re: [tpm2] Use endorsement key for encryption and
decryption
        Message-ID:
                <

476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.corp.intel.com>

Content-Type: text/plain; charset="utf-8"

> -----Original Message-----
> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org] On Behalf Of
arjun kashyap

        > Sent: Sunday, March 3, 2019 12:58 PM
        > To: tpm2(a)lists.01.org
        > Subject: [tpm2] Use endorsement key for encryption and

decryption
>
> Hello all,
>
> I am using the IBM tpm2.0 simulator. My use case is that I
would like to encrypt
> data and send to tpm and then decrypt this at the tpm side. I
would want to use
> the endorsement key (EK) for this purpose. Hence, I would like
to encrypt data
> using EK's public key and decrypt using EK's private key. I
tried creating EK using
> tpm2_createek -G rsa -f pem -c - -p ek.pem. Now, I have the
ek.pem( public
> portion of EK) to encrypt the data. When I load this key into
the tpm and invoke
> tpm2_rsadecrypt I get an error. I also tried using
tpm2_createprimary to create
> an EK but failed in the above attempt. Could anyone please help
me out so that I

        > can use EK to encrypt/decrypt data.
        >
        > Please let me know if more information is needed.

        What's the error code? You probably can't perform an rsadecrypt,
        Do to object attributes. I would bet sign would work. Endorsement
        usually means signing.

        >
        > Thanks in advance.
        >
        >  <https://www.avast.com/sig-
        > email?utm_medium=email&utm_source=link&utm_campaign=sig-
        > email&utm_content=webmail&utm_term=icon>       Virus-free.
        > www.avast.com <https://www.avast.com/sig-
        > email?utm_medium=email&utm_source=link&utm_campaign=sig-
        > email&utm_content=webmail&utm_term=link>


        ------------------------------

        Subject: Digest Footer

        _______________________________________________
        tpm2 mailing list
        tpm2(a)lists.01.org
        https://lists.01.org/mailman/listinfo/tpm2


        ------------------------------

        End of tpm2 Digest, Vol 21, Issue 2
        ***********************************
Quoted 5 lines

_______________________________________________
tpm2 mailing list
tpm2(a)lists.01.org
https://lists.01.org/mailman/listinfo/tpm2

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon> Virus-free. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#m_6257261603722230097_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

#6 lore raw
In reply to arjun kashyap

You should probably use a non-primary key for this, nor a restricted key for this. Just create a key in the appropriate hierarchy under a primary object via tpm2_create

If you need the public portion of an object as a PEM output, tpm2_readpublic will do it.

Quoted 175 lines

-----Original Message-----
From: arjun kashyap [mailto:arjun21k(a)gmail.com]
Sent: Thursday, March 7, 2019 11:42 AM
To: Desai, Imran <imran.desai(a)intel.com>; Roberts, William C <william.c.roberts(a)intel.com>; tpm2(a)lists.01.org
Subject: Re: [tpm2] tpm2 Digest, Vol 21, Issue 2

Thanks William and Imran for your inputs. My use case is that once my system boots up (with tpm) I should be able to send encrypted data to it over the network. I thought I could use the EK as each tpm has a unique and built-in one. My thought process was to try to use the EK public portion to encrypt the data and send it over the network to the tpm and then decrypt it using EK private portion. As both of you pointed out that I should set appropriate attributes while creating the key and prefer using tpm2_createprimary instead of tpm2_createek. But I have another concern with this approach. With tpm2_createek I could extract the public key portion of the EK which gets created. But if I use tpm2_createprimary I do not have that option. So could you suggest some workaround? Also, please feel free to suggest another approach for this use case. Kindly correct me if I am wrong as I am new to tpms.

Thanks again,
Arjun

On Tue, Mar 5, 2019 at 3:27 PM Desai, Imran <imran.desai(a)intel.com <mailto:imran.desai(a)intel.com> > wrote:

For what you want to do, try this.

tpm2_createprimary -a e -G rsa -A
"fixedtpm|fixedparent|sensitivedataorigin|userwithauth|adminwithpolicy|decr ypt" -o key.ctx

	tpm2_evictcontrol -a o -c key.ctx -p 0x81010002
	tpm2_rsaencrypt -c 0x81010002 -o enc.out plain.txt
	tpm2_rsadecrypt -c 0x81010002 -o dec.out -I enc.out

	PS: I would not use such a key if I cared about privacy.

	On 3/5/19, 1:50 PM, "Desai, Imran" <imran.desai(a)intel.com

<mailto:imran.desai(a)intel.com> > wrote:

+1 to what Bill said. If you must do this I'd suggest you use
createprimary to create the key under endorsement hierarchy. I understand that is exactly what tpm2_createek does but there is a caveat. For what you intend to do it requires userwith attribute set to 1. The reason it is not set to 1 in createek tool is because it would create an endorsement key off a non standard template per TCK EK credential profile spec. The alternative is to satisfy policysecret of the endorsement hierarchy and that will require a change in the tool.

	    On 3/5/19, 1:00 PM, "tpm2 on behalf of tpm2-request(a)lists.01.org

<mailto:tpm2-request(a)lists.01.org> " <tpm2-bounces(a)lists.01.org <mailto:tpm2-bounces(a)lists.01.org> on behalf of tpm2-request(a)lists.01.org <mailto:tpm2-request(a)lists.01.org> > wrote:

Send tpm2 mailing list submissions to
tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org>

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/tpm2
or, via email, send a message with subject or body 'help' to
tpm2-request(a)lists.01.org <mailto:tpm2-request(a)lists.01.org>

You can reach the person managing the list at
tpm2-owner(a)lists.01.org <mailto:tpm2-owner(a)lists.01.org>

When replying, please edit your Subject line so it is more specific than "Re: Contents of tpm2 digest..."

Today's Topics:

1. Re: Use endorsement key for encryption and decryption (Roberts, William C)

----------------------------------------------------------------------

Message: 1
Date: Tue, 5 Mar 2019 17:29:10 +0000
From: "Roberts, William C" <william.c.roberts(a)intel.com
<mailto:william.c.roberts(a)intel.com> >
To: arjun kashyap <arjun21k(a)gmail.com
<mailto:arjun21k(a)gmail.com> >, "tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org> "

	                <tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org> >
	        Subject: Re: [tpm2] Use endorsement key for encryption and

decryption
Message-ID:

<476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.corp.intel.c om <mailto:476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.cor p.intel.com> >

	        Content-Type: text/plain; charset="utf-8"



	        > -----Original Message-----
	        > From: tpm2 [mailto:tpm2-bounces(a)lists.01.org <mailto:tpm2-
bounces(a)lists.01.org> ] On Behalf Of arjun kashyap
	        > Sent: Sunday, March 3, 2019 12:58 PM
	        > To: tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org>
	        > Subject: [tpm2] Use endorsement key for encryption and
decryption
	        >
	        > Hello all,
	        >
	        > I am using the IBM tpm2.0 simulator. My use case is that I would like

to encrypt
> data and send to tpm and then decrypt this at the tpm side. I would
want to use
> the endorsement key (EK) for this purpose. Hence, I would like to
encrypt data
> using EK's public key and decrypt using EK's private key. I tried
creating EK using
> tpm2_createek -G rsa -f pem -c - -p ek.pem. Now, I have the
ek.pem( public
> portion of EK) to encrypt the data. When I load this key into the tpm
and invoke
> tpm2_rsadecrypt I get an error. I also tried using
tpm2_createprimary to create
> an EK but failed in the above attempt. Could anyone please help me
out so that I
> can use EK to encrypt/decrypt data.
>
> Please let me know if more information is needed.

What's the error code? You probably can't perform an rsadecrypt, Do to object attributes. I would bet sign would work. Endorsement usually means signing.

>
> Thanks in advance.
>
> <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig-
> email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com <http://www.avast.com>
<https://www.avast.com/sig-

	        > email?utm_medium=email&utm_source=link&utm_campaign=sig-
	        > email&utm_content=webmail&utm_term=link>


	        ------------------------------

	        Subject: Digest Footer

	        _______________________________________________
	        tpm2 mailing list
	        tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org>
	        https://lists.01.org/mailman/listinfo/tpm2


	        ------------------------------

	        End of tpm2 Digest, Vol 21, Issue 2
	        ***********************************




	_______________________________________________
	tpm2 mailing list
	tpm2(a)lists.01.org <mailto:tpm2(a)lists.01.org>
	https://lists.01.org/mailman/listinfo/tpm2

<https://www.avast.com/sig-
email?utm_medium=email&utm_source=link&utm_campaign=sig-
email&utm_content=webmail&utm_term=icon> Virus-free.
www.avast.com <https://www.avast.com/sig-
email?utm_medium=email&utm_source=link&utm_campaign=sig- email&utm_content=webmail&utm_term=link>

#7 lore raw
In reply to a message not in the archive

Additionally it will also have to be non restricted decryption key.

On 3/5/19, 1:00 PM, "tpm2 on behalf of tpm2-request(a)lists.01.org" <tpm2-bounces(a)lists.01.org on behalf of tpm2-request(a)lists.01.org> wrote:

Send tpm2 mailing list submissions to
tpm2(a)lists.01.org

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/tpm2
or, via email, send a message with subject or body 'help' to
tpm2-request(a)lists.01.org

You can reach the person managing the list at
tpm2-owner(a)lists.01.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of tpm2 digest..."

Today's Topics:

1. Re: Use endorsement key for encryption and decryption (Roberts, William C)

----------------------------------------------------------------------

Message: 1
Date: Tue, 5 Mar 2019 17:29:10 +0000
From: "Roberts, William C" <william.c.roberts(a)intel.com>
To: arjun kashyap <arjun21k(a)gmail.com>, "tpm2(a)lists.01.org"
<tpm2(a)lists.01.org>
Subject: Re: [tpm2] Use endorsement key for encryption and decryption Message-ID:
<476DC76E7D1DF2438D32BFADF679FC5649CFA6CA(a)ORSMSX101.amr.corp.intel.com>

Content-Type: text/plain; charset="utf-8"

> -----Original Message-----
> From: tpm2 [mailto:tpm2-bounces(a)lists.01.org] On Behalf Of arjun kashyap > Sent: Sunday, March 3, 2019 12:58 PM
> To: tpm2(a)lists.01.org
> Subject: [tpm2] Use endorsement key for encryption and decryption
>
> Hello all,
>
> I am using the IBM tpm2.0 simulator. My use case is that I would like to encrypt > data and send to tpm and then decrypt this at the tpm side. I would want to use > the endorsement key (EK) for this purpose. Hence, I would like to encrypt data > using EK's public key and decrypt using EK's private key. I tried creating EK using > tpm2_createek -G rsa -f pem -c - -p ek.pem. Now, I have the ek.pem( public > portion of EK) to encrypt the data. When I load this key into the tpm and invoke > tpm2_rsadecrypt I get an error. I also tried using tpm2_createprimary to create > an EK but failed in the above attempt. Could anyone please help me out so that I > can use EK to encrypt/decrypt data.
>
> Please let me know if more information is needed.

What's the error code? You probably can't perform an rsadecrypt, Do to object attributes. I would bet sign would work. Endorsement usually means signing.

>
> Thanks in advance.
>
> <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig-
> email&utm_content=webmail&utm_term=icon> Virus-free.
> www.avast.com <https://www.avast.com/sig-
> email?utm_medium=email&utm_source=link&utm_campaign=sig- > email&utm_content=webmail&utm_term=link>

------------------------------

Subject: Digest Footer

_______________________________________________
tpm2 mailing list
tpm2(a)lists.01.org
https://lists.01.org/mailman/listinfo/tpm2

------------------------------

End of tpm2 Digest, Vol 21, Issue 2
***********************************