-
Notifications
You must be signed in to change notification settings - Fork 407
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
Invalid datatype for DTLS/TLS Ciphersuite
resource (/0/?/16) in BootstrapConfig.
#1402
Comments
I just looked at this and I think you find a bug in You right that ciphersuite resource (Id:16) from Security Object (id:0) is defined as <Item ID="16">
<Name>DTLS/TLS Ciphersuite</Name>
<Operations></Operations>
<MultipleInstances>Multiple</MultipleInstances>
<Mandatory>Optional</Mandatory>
<Type>Unsigned Integer</Type>
<RangeEnumeration></RangeEnumeration>
<Units></Units>
<Description><![CDATA[When this resource is present it instructs the TLS/DTLS client to propose
the indicated ciphersuite(s) in the ClientHello of the handshake. A ciphersuite is indicated as a 32-bit integer value.
The IANA TLS ciphersuite registry is maintained at https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml.
As an example, the TLS_PSK_WITH_AES_128_CCM_8 ciphersuite is represented with the following string "0xC0,0xA8".
To form an integer value the two values are concatenated. In this example, the value is 0xc0a8 or 49320.]]></Description>
</Item> (Source : https://github.com/OpenMobileAlliance/lwm2m-registry/blob/prod/version_history/0-1_1.xml#L260-L269) This resource was added in LWM2M v1.1 (so doesn't not affect Leshan v1.x).
So first we need to fix the single => multiple mistake and so replace
There is no other For ciphersuite resource, I'm not sure we need to let user being able to chose resource instance id.... (that's why I propose ordered collection without key) ULong, OR String OR Dedicated CipherSuite type ? is another question. The benefits to use ULong, is that Leshan doesn't need to know all ciphersuite (no need to have a kind of registry class for it) Current ULong way, is very very not userfriendly as user need to create the ULong from CipherSuite ID. So I don't know what we should do.
Or any other idea ? |
I think the second solution is the best one as it would be easy to implement and wouldn't require dedicated classes which seems like an overkill to me |
Thinking a bit more about this. Probably 1.) is overkill. (But we can keep it in mind in case one day we found another use case where a Between 2.) and 3.) the difference is mainly between creating an utility class or create a new "bean" class. What do you think ? @JaroslawLegierski any opinion about this ? |
(let us know at #1401 if we need this one for M11) |
It seems to me that solution 2 may be a bit simpler to implement, but solution 3 will be easier for future usage |
3. should not be so hard, just adding a new class like this : public class CipherSuiteId {
private byte firstByte;
private byte secondByte;
// OR
// private byte[] id, // should have a size of 2
/**
* The IANA TLS ciphersuite registry is maintained at https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml.
* As an example, the TLS_PSK_WITH_AES_128_CCM_8 ciphersuite is represented with the following string "0xC0,0xA8"
*/
public CipherSuiteId(byte firstByte, byte secondByte) {
// set attibutes
}
public CipherSuiteId(Ulong valueFromSecurityObject) {
// extract bytes from ULong : same code as if we used an utility method like 2.
// set attibutes
}
/**
* As an example, the TLS_PSK_WITH_AES_128_CCM_8 ciphersuite is represented with the following string "0xC0,0xA8".
To form an integer value the two values are concatenated. In this example, the value is 0xc0a8 or 49320.
*/
public ULong getValueForSecurityObject() {
// create ULong from attributes : same case as if we used an utility method like 2.
}
} Javadoc could probably be better. |
I've created a branch and implemented this change on opl/CipherSuiteId |
I looked at the branch quickly, there are some minor issues but it will be easier to comment in a PR. The main problem I see is that you don't use a type that allows multiple ciphersuite 🤔 ... I thought that was the main problem you reported? |
My bad. I've pushed a correction |
I don't get your last commit 🤔 Why not just using : And here :
You should not create a single resource of type OPAQUE but several resource instance of type UNSIGNED_INTEGER. |
I wanted to have an method in BootstrapConfig.java to generate ULong[] without any additional imports in BootstrapUtil.java and this was soulution that i thought of. I don't remember why. |
I guess you don't get what I meant by :
The model is Multiple so you must create HTH (any reason to not create a PR ?) |
I've created a PR |
👍 I will look at it. |
I found something which sounds strange to me in specification about that. I asked for clarification : OpenMobileAlliance/OMA_LwM2M_for_Developers#560 |
DTLS/TLS Ciphersuite
resource (/0/?/16) in BootstrapConfig.
Co-authored-by: Simon Bernard <sbernard@sierrawireless.com>
… BootstrapConfig Co-authored-by: Simon Bernard <sbernard@sierrawireless.com>
… BootstrapConfig Co-authored-by: Simon Bernard <sbernard@sierrawireless.com>
Question
In BootstrapConfig.java line 335:
In OMA documentation cipherSuite is defined as "Multiple" but from what I can read above it seems that the resource can be "concatenated" to integer value. My question is: Is ULong a correct type for this resource or should it be another type that could contain 2 Strings?
The text was updated successfully, but these errors were encountered: