attestation: set key name in FinishCertRequest

The caller of CreateCertRequest doesn't provide the eventual key name,
so when CertifiedKey is generated, the key name is set to a random
string. When a key is not tied to a specific user, the key name
is used to uniquely identify the key in the local attestation database.
Thus, attestationd must set the name of the CertifiedKey in FinishCertRequest.

BUG=chrome-os-partner:59478
TEST=Verify that the following succeeds:
     1) attestation_client create_cert_request --profile=machine \
        --origin=aaa --output=/tmp/cert_request
     2) curl -X POST -v -H "Content-Type: application/octet-stream" \
        -T /tmp/cert_request -o /tmp/cert_response \
        https://chromeos-ca.gstatic.com/sign
     3) attestation_client finish_cert_request --label=zzz \
        --input=/tmp/cert_response
     4) attestation_client info --label=zzz

Change-Id: I23763eab8a9f2d6cc4e50794119d2016485ecd1d
Reviewed-on: https://chromium-review.googlesource.com/410403
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
1 file changed