-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #937 from rnrneverdies/0.9
Added Widevine Base Aquisition Url + FairPlay support
- Loading branch information
Showing
7 changed files
with
116 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
.../windowsazure/services/media/implementation/templates/fairplay/FairPlayConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.microsoft.windowsazure.services.media.implementation.templates.fairplay; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.security.KeyStore; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.microsoft.windowsazure.core.utils.Base64; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class FairPlayConfiguration { | ||
|
||
private String askId; | ||
|
||
private String fairPlayPfxPasswordId; | ||
|
||
private String fairPlayPfx; | ||
|
||
private String contentEncryptionIV; | ||
|
||
public static String createSerializedFairPlayOptionConfiguration( | ||
KeyStore keyStore, String pfxPassword, String pfxPasswordKeyId, String askId, | ||
String contentIv) { | ||
try { | ||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | ||
keyStore.store(outputStream, pfxPassword.toCharArray()); | ||
String certString = Base64.encode(outputStream.toByteArray()); | ||
FairPlayConfiguration config = new FairPlayConfiguration(); | ||
config.askId = askId; | ||
config.contentEncryptionIV = contentIv; | ||
config.fairPlayPfx = certString; | ||
config.fairPlayPfxPasswordId = pfxPasswordKeyId; | ||
ObjectMapper mapper = new ObjectMapper(); | ||
String configuration = mapper.writeValueAsString(config); | ||
|
||
return configuration; | ||
} catch (Throwable t) { | ||
throw new RuntimeException(t); | ||
} | ||
} | ||
|
||
static final char[] HEXARRAY = "0123456789ABCDEF".toCharArray(); | ||
public static String bytesToHex(byte[] bytes) { | ||
char[] hexChars = new char[bytes.length * 2]; | ||
for (int j = 0; j < bytes.length; j++) { | ||
int v = bytes[j] & 0xFF; | ||
hexChars[j * 2] = HEXARRAY[v >>> 4]; | ||
hexChars[j * 2 + 1] = HEXARRAY[v & 0x0F]; | ||
} | ||
return new String(hexChars); | ||
} | ||
|
||
@JsonProperty("ASkId") | ||
public String getASkId() { | ||
return askId; | ||
} | ||
|
||
@JsonProperty("FairPlayPfxPasswordId") | ||
public String getFairPlayPfxPasswordId() { | ||
return fairPlayPfxPasswordId; | ||
} | ||
|
||
@JsonProperty("FairPlayPfx") | ||
public String getFairPlayPfx() { | ||
return fairPlayPfx; | ||
} | ||
|
||
@JsonProperty("ContentEncryptionIV") | ||
public String getContentEncryptionIV() { | ||
return contentEncryptionIV; | ||
}; | ||
} |
1 change: 1 addition & 0 deletions
1
...microsoft/windowsazure/services/media/implementation/templates/fairplay/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package com.microsoft.windowsazure.services.media.implementation.templates.fairplay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters