-
I have ported the library to a PIC24 environment and have most functions working, however when I try to compute HMAC, I always get an invalid OID (0x8001) response. I've used ECDH, and TLS PRF to derive a key in OPTIGA_KEY_ID_SESSION_BASED, and I've also tried putting random data in arbitrary data objects such as 0xF1D0, and even generating a key in OPTIGA_KEY_ID_SECRET_BASED. Does the secret need to be a specific size that might be causing this? Here is the core code for the HMAC operation:
` Also, I'm unclear from the documentation on which function to use. Right now, I'm using optiga_crypt_hmac, but I have also tried optiga_crypt_hmac_start/update/final methods. When should I choose one vs the other set of methods? I would like to use the single optiga_crypt_hmac method for simplicity, but I'm not sure if there are any limitations on the input data size. If there are limits on the input size, say 128 bytes, which methods should be called for data that is 127, 128, and 129 bytes? Any help much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi there, you asked a couple of questions. I'll try to focus at least on the code snippet you have provided. static const uint8_t metadata [] = {
//Metadata tag in the data object
0x20, 0x06,
//Data object type set to PRESSEC
0xE8, 0x01, 0x21,
// Execute Access condition descriptor set to ALWAYS
0xD3, 0x01, 0x00,
}; with a secret stored in a data object you might get a different error, can you show it here, what error do you get?
The difference is that you might do hmac continiously in different points of time (so the patter here would be one start, many updates and one finalize inthe end), or you might do an hmac in one shot. |
Beta Was this translation helpful? Give feedback.
Hi there,
you asked a couple of questions. I'll try to focus at least on the code snippet you have provided.
Hete you try to calculate an hmac using OPTIGA_KEY_ID_SESSION_BASED, for this you get an invalid OID error.
Invalid OID error means (in this particlar case) that the OID you are using doesn't contain a pre-shared secret and probably can't be used internally (EXECUTE access condition). You indicate that the OID is a pre-shared secret by setting up a corresponing metadata.