Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@josephlr
Copy link
Member

@josephlr josephlr commented Jul 19, 2019

Depends on #122 (for proper testing).

This allows TPM2_Import to be called from go-tpm.

The code is ready for review, but this PR still needs tests.

Copy link
Contributor

@awly awly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test please

tpm2/tpm2.go Outdated
// or in a different TPM. The publicBlob and privateBlob must always be
// provided. symSeed should be non-nil iff an "outer wrapper" is used. Both of
// encryptionKey and sym should be non-nil iff an "inner wrapper" is used.
func ImportUsingAuth(rw io.ReadWriter, parentHandle tpmutil.Handle, auth AuthCommand, publicBlob, privateBlob, symSeed, encryptionKey []byte, sym *SymScheme) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of this "UsingAuth" naming pattern.
Can this command be used without auth?

If the other alternative is using PasswordSession, maybe we refactor everything to take AuthCommand and add a helper func PasswordAuth(pass string) AuthCommand?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of this "UsingAuth" naming pattern.
Can this command be used without auth?

Nope, it will always need some sort of authorization (usually session authorization). I changed the name to Import to reflect this.

If the other alternative is using PasswordSession, maybe we refactor everything to take AuthCommand and add a helper func PasswordAuth(pass string) AuthCommand?

I think a better idea might be to have a common Auth interface which is implemented by PasswordAuth and SessionAuth, allowing a user to just passPasswordAuth or SessionAuth whereever an auth value is needed, but that's something we should probably address later.

@josephlr josephlr changed the title Add ImportWithAuth Add Import command Sep 4, 2019
@twitchy-jsonp twitchy-jsonp self-requested a review September 6, 2019 23:18
@josephlr
Copy link
Member Author

Add a test please

Done, the test is a just a "plain" Import that doesn't use an inner or outer wrapper. See google/go-tpm-tools#36 for more complex tests.

@josephlr josephlr merged commit 33a9c3f into master Sep 10, 2019
@josephlr josephlr deleted the import branch September 10, 2019 20:31
@giapnguyen74
Copy link

giapnguyen74 commented Sep 12, 2019

Could you give an example for import a AES 128 bit key? I try to replace tmp2_import external aes key but no luck. Thanks.
-- Never mind, I just figure out how to import AES key :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants