Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to properly verify the client's public key and proof? #5

Open
butaikis opened this issue Aug 18, 2024 · 0 comments
Open

How to properly verify the client's public key and proof? #5

butaikis opened this issue Aug 18, 2024 · 0 comments

Comments

@butaikis
Copy link

Hi. Please tell me, I have a problem with the M3 stage.
I receive a public key and a proof from TLV8 from the client. How do I extract them correctly and check them on the server side?

        tlv_t tlv_public_key = HAP_TLV8_Get_Val(kTLVType_PublicKey, request.data_only, request.data_len);
        tlv_t tlv_proof = HAP_TLV8_Get_Val(kTLVType_Proof, request.data_only, request.data_len);


        mbedtls_mpi *p = (mbedtls_mpi*)malloc(sizeof(mbedtls_mpi));
        mbedtls_mpi_init(p);
        mbedtls_mpi_read_binary(p, tlv_public_key.data, tlv_public_key.size);
        
        mbedtls_mpi *pr = (mbedtls_mpi*)malloc(sizeof(mbedtls_mpi));
        mbedtls_mpi_init(pr);
        mbedtls_mpi_read_binary(pr, tlv_proof.data, tlv_proof.size);
        

        srp_compute_key(srp_server, p);
        int res_verify = srp_verify_key(srp_server, pr);
        if (res_verify)
        {
            debug("Server failed to validate Client");
        }
        else
            debug("Verify client OK");
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

No branches or pull requests

1 participant