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

Add cryptex attribute to fingerprint packet extension. #87

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,13 @@ public static JSONObject serializeFingerprint(
serializeAbstractPacketExtensionAttributes(
fingerprint,
fingerprintJSONObject);
Object cryptex = fingerprintJSONObject.get(DtlsFingerprintPacketExtension.CRYPTEX_ATTR_NAME);
if (cryptex instanceof String)
{
/* Represent cryptex as a boolean. */
fingerprintJSONObject.put(DtlsFingerprintPacketExtension.CRYPTEX_ATTR_NAME,
Boolean.parseBoolean((String)cryptex));
}
}
return fingerprintJSONObject;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ public class DtlsFingerprintPacketExtension
*/
private static final String SETUP_ATTR_NAME = "setup";

/**
* The XML name of the <tt>fingerprint</tt> element's attribute which
* signals whether it supports the cryptex extension. Note: This is non-standard.
*/
public static final String CRYPTEX_ATTR_NAME = "cryptex";

/** Initializes a new <tt>DtlsFingerprintPacketExtension</tt> instance. */
public DtlsFingerprintPacketExtension()
{
Expand Down Expand Up @@ -117,6 +123,17 @@ public String getSetup()
return getAttributeAsString(SETUP_ATTR_NAME);
}

/**
* Returns value of 'cryptex' attribute. See {@link #CRYPTEX_ATTR_NAME} for more
* info.
*/
public boolean getCryptex()
{
String attr = getAttributeAsString(CRYPTEX_ATTR_NAME);

return (attr == null) ? false : Boolean.parseBoolean(attr);
}

/**
* Sets the fingerprint to be carried/represented by this instance.
*
Expand Down Expand Up @@ -157,4 +174,13 @@ public void setSetup(String setup)
{
setAttribute(SETUP_ATTR_NAME, setup);
}

/**
* Sets new value for 'cryptex' attribute.
* @param cryptex see {@link #CRYPTEX_ATTR_NAME} for details.
*/
public void setCryptex(Boolean cryptex)
{
setAttribute(CRYPTEX_ATTR_NAME, cryptex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ private val expectedMappings = listOf(
<endpoint xmlns="jitsi:colibri2" id="79f0273e">
<transport>
<transport xmlns="urn:xmpp:jingle:transports:ice-udp:1" pwd="1a5ejbent91k6io6a3fauikg22" ufrag="2ivqh1fvtf0l3h">
<fingerprint xmlns="urn:xmpp:jingle:apps:dtls:0" setup="actpass" hash="sha-256">2E:CC:85:71:32:5B:B5:60:64:C8:F6:7B:6D:45:D4:34:2B:51:A0:06:B5:EA:2F:84:BC:7B:64:1F:A3:0A:69:23</fingerprint>
<fingerprint xmlns="urn:xmpp:jingle:apps:dtls:0" setup="actpass" hash="sha-256" cryptex="true">2E:CC:85:71:32:5B:B5:60:64:C8:F6:7B:6D:45:D4:34:2B:51:A0:06:B5:EA:2F:84:BC:7B:64:1F:A3:0A:69:23</fingerprint>
<web-socket xmlns="http://jitsi.org/protocol/colibri" url="wss://beta-us-ashburn-1-global-2808-jvb-83-102-26.jitsi.net:443/colibri-ws/default-id/3d937bbdf97a23e0/79f0273e?pwd=1a5ejbent91k6io6a3fauikg22"/>
<rtcp-mux/>
<candidate component="1" foundation="2" generation="0" id="653aa1ba295b62480ffffffffdc52c0d9" network="0" priority="1694498815" protocol="udp" type="srflx" ip="129.80.210.199" port="10000" rel-addr="0.0.0.0" rel-port="9"/>
Expand Down Expand Up @@ -342,7 +342,8 @@ private val expectedMappings = listOf(
{
"fingerprint": "2E:CC:85:71:32:5B:B5:60:64:C8:F6:7B:6D:45:D4:34:2B:51:A0:06:B5:EA:2F:84:BC:7B:64:1F:A3:0A:69:23",
"setup": "actpass",
"hash": "sha-256"
"hash": "sha-256",
"cryptex": true
}
]
}
Expand Down