Skip to content

Commit f8f0c77

Browse files
committed
Updated for alias support in 1.2.16
1 parent fa3fbeb commit f8f0c77

File tree

5 files changed

+71
-14
lines changed

5 files changed

+71
-14
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.red5</groupId>
55
<artifactId>red5-parent</artifactId>
6-
<version>1.2.13</version>
6+
<version>1.2.16</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>red5-server</artifactId>

src/main/java/org/red5/server/net/rtmp/InboundHandshake.java

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.bouncycastle.util.BigIntegers;
1818
import org.red5.server.api.Red5;
1919
import org.red5.server.net.rtmp.message.Constants;
20-
import org.slf4j.LoggerFactory;
2120

2221
/**
2322
* Performs handshaking for server connections.
@@ -39,12 +38,10 @@ public class InboundHandshake extends RTMPHandshake {
3938

4039
public InboundHandshake() {
4140
super(RTMPConnection.RTMP_NON_ENCRYPTED);
42-
log = LoggerFactory.getLogger(InboundHandshake.class);
4341
}
4442

4543
public InboundHandshake(byte handshakeType) {
4644
super(handshakeType);
47-
log = LoggerFactory.getLogger(InboundHandshake.class);
4845
}
4946

5047
public InboundHandshake(byte handshakeType, int algorithm) {
@@ -184,14 +181,14 @@ public IoBuffer decodeClientRequest1(IoBuffer in) {
184181
log.debug("RTMPE type 8 XTEA");
185182
// encrypt signatureResp
186183
for (int i = 0; i < DIGEST_LENGTH; i += 8) {
187-
//encryptXtea(signatureResp, i, digestResp[i] % 15);
184+
encryptXtea(signatureResponse, i, digestResp[i] % 15);
188185
}
189186
break;
190187
case RTMPConnection.RTMP_ENCRYPTED_BLOWFISH:
191188
log.debug("RTMPE type 9 Blowfish");
192189
// encrypt signatureResp
193190
for (int i = 0; i < DIGEST_LENGTH; i += 8) {
194-
//encryptBlowfish(signatureResp, i, digestResp[i] % 15);
191+
encryptBlowfish(signatureResponse, i, digestResp[i] % 15);
195192
}
196193
break;
197194
}
@@ -250,14 +247,14 @@ public boolean decodeClientRequest2(IoBuffer in) {
250247
log.debug("RTMPE type 8 XTEA");
251248
// encrypt signature
252249
for (int i = 0; i < DIGEST_LENGTH; i += 8) {
253-
//encryptXtea(signature, i, digest[i] % 15);
250+
encryptXtea(signature, i, digest[i] % 15);
254251
}
255252
break;
256253
case RTMPConnection.RTMP_ENCRYPTED_BLOWFISH:
257254
log.debug("RTMPE type 9 Blowfish");
258255
// encrypt signature
259256
for (int i = 0; i < DIGEST_LENGTH; i += 8) {
260-
//encryptBlowfish(signature, i, digest[i] % 15);
257+
encryptBlowfish(signature, i, digest[i] % 15);
261258
}
262259
break;
263260
}
@@ -408,6 +405,33 @@ private boolean validateScheme(byte[] handshake, int scheme) {
408405
return result;
409406
}
410407

408+
/**
409+
* Encrypt via xtea.
410+
*
411+
* @param in
412+
* @param index
413+
* @param keyId
414+
*/
415+
private void encryptXtea(byte[] in, int index, int keyId) {
416+
//xtea_le_init(XTEA_KEYS[keyId]);
417+
//xtea_le_crypt(out, in, 1, NULL, 0);
418+
}
419+
420+
/**
421+
* Encrypt via blowfish.
422+
*
423+
* @param in
424+
* @param index
425+
* @param keyId
426+
*/
427+
private void encryptBlowfish(byte[] in, int index, int keyId) {
428+
if (blowfish == null) {
429+
initBlowfishEncryption(keyId);
430+
}
431+
// overwrite in as out using same array
432+
blowfish.processBlock(in, index, in, index);
433+
}
434+
411435
public void setHandshakeBytes(byte[] handshake) {
412436
this.handshakeBytes = handshake;
413437
}

src/main/server/conf/red5-common.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<!-- High level access to streams -->
7272
<bean id="streamService" class="org.red5.server.stream.StreamService">
7373
<property name="stripTypePrefix" value="true"/>
74-
<property name="nameAliasingEnabled" value="true"/>
74+
<property name="nameAliasingEnabled" value="false"/>
7575
</bean>
7676

7777
<!-- High level access to broadcasted streams -->
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="ISO-8859-1"?>
2+
<!-- Adobe DTD for cross-domain policy files -->
3+
<!-- Copyright (c) 2008-2009, Adobe Systems Inc. -->
4+
5+
<!ELEMENT cross-domain-policy (site-control?,allow-access-from*,allow-http-request-headers-from*,allow-access-from-identity*)>
6+
7+
<!ELEMENT site-control EMPTY>
8+
<!ATTLIST site-control permitted-cross-domain-policies (all|by-content-type|by-ftp-filename|master-only|none) #REQUIRED>
9+
10+
<!ELEMENT allow-access-from EMPTY>
11+
<!ATTLIST allow-access-from domain CDATA #REQUIRED>
12+
<!ATTLIST allow-access-from to-ports CDATA #IMPLIED>
13+
<!ATTLIST allow-access-from secure (true|false) "true">
14+
15+
<!ELEMENT allow-http-request-headers-from EMPTY>
16+
<!ATTLIST allow-http-request-headers-from domain CDATA #REQUIRED>
17+
<!ATTLIST allow-http-request-headers-from headers CDATA #REQUIRED>
18+
<!ATTLIST allow-http-request-headers-from secure (true|false) "true">
19+
20+
<!ELEMENT allow-access-from-identity (signatory)>
21+
22+
<!ELEMENT signatory (certificate)>
23+
24+
<!ELEMENT certificate EMPTY>
25+
<!ATTLIST certificate fingerprint CDATA #IMPLIED>
26+
<!ATTLIST certificate fingerprint-algorithm CDATA #IMPLIED>
27+
28+
<!-- End of file. -->
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
<?xml version="1.0" encoding="ISO-8859-1"?>
2-
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
1+
<?xml version="1.0"?>
2+
<!DOCTYPE cross-domain-policy SYSTEM "cross-domain-policy.dtd">
33
<cross-domain-policy>
4-
<site-control permitted-cross-domain-policies="all"/>
5-
<allow-access-from domain="*" to-ports="1935"/>
6-
<allow-http-request-headers-from domain="*" headers="*"/>
4+
<site-control permitted-cross-domain-policies="all"/>
5+
<allow-access-from domain="*" to-ports="1935"/>
6+
<allow-http-request-headers-from domain="*" headers="*"/>
7+
<allow-access-from-identity>
8+
<signatory>
9+
<certificate/>
10+
</signatory>
11+
</allow-access-from-identity>
712
</cross-domain-policy>

0 commit comments

Comments
 (0)