TPM2 (Trusted Platform Module) userspace development
 help / color / mirror / Atom feed
From: Desai, Imran <imran.desai at intel.com>
To: tpm2@lists.01.org
Subject: Re: [tpm2] tpm2 Digest, Vol 21, Issue 2
Date: Tue, 05 Mar 2019 21:27:52 +0000	[thread overview]
Message-ID: <71B2FF90-DEFD-441F-B734-D86739D855AF@intel.com> (raw)
In-Reply-To: F50B7B1A-F3CF-4298-B129-D3650443D5EF@intel.com

[-- Attachment #1: Type: text/plain, Size: 4738 bytes --]

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
        ***********************************
        
    
    


             reply	other threads:[~2019-03-05 21:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 21:27 Desai, Imran [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-03-13 13:43 [tpm2] tpm2 Digest, Vol 21, Issue 2 Roberts, William C
2019-03-08  3:04 arjun kashyap
2019-03-07 21:40 Fuchs, Andreas
2019-03-07 19:41 arjun kashyap
2019-03-05 21:12 Desai, Imran
2019-03-05 20:50 Desai, Imran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71B2FF90-DEFD-441F-B734-D86739D855AF@intel.com \
    --to=tpm2@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox