jitsi / jitsi-srtp Goto Github PK
View Code? Open in Web Editor NEWSRTP implementation for Jitsi
License: Apache License 2.0
SRTP implementation for Jitsi
License: Apache License 2.0
Trying to piece together how to get jitsi server-side running on FreeBSD, and keep finding native pre-compiled binaries in various of the repositories - this being one of them. Is there a reason these things need native code? If yes, it would be preferable if the build process was at least platform-agnostic. The assumption that everything is Linux isn't entirely true :)
Submitted for consideration is a fix for Aes.SunPKCS11CipherFactory
for JDK 11+.
/**
* Implements {@link CipherFactory} using Sun PKCS#11.
*
* @author Lyubomir Marinov
*/
public static class SunPKCS11CipherFactory extends CipherFactory {
/**
* The {@link Provider} instance (to be) employed for an (optimized) AES
* implementation.
*/
private static Provider provider;
/**
* The indicator which determines whether {@link #provider} is to be
* used. If {@code true}, an attempt will be made to initialize a {@link
* Provider} instance. If the attempt fails, {@code false} will be
* assigned in order to not repeatedly attempt the initialization which
* is known to have failed.
*/
private static boolean useProvider = true;
/**
* Gets the {@code java.security.Provider} instance (to be) employed
* for an (optimized) AES implementation.
*
* @return the {@code java.security.Provider} instance (to be) employed
* for an (optimized) AES implementation
*/
public static Provider getProvider() throws Exception {
Provider provider = SunPKCS11CipherFactory.provider;
if (provider == null && useProvider) {
try {
// The SunPKCS11 Config name should be unique in order
// to avoid repeated initialization exceptions.
String name = null;
Package pkg = Aes.class.getPackage();
if (pkg != null) {
name = pkg.getName();
}
if (name == null || name.length() == 0) {
name = "org.jitsi.srtp";
}
String config = "--name=" + name + "\\n" + "nssDbMode=noDb\\n" + "attributes=compatibility";
Provider prototype = Security.getProvider("SunPKCS11");
Class<?> sunPkcs11ProviderClass = Class.forName("sun.security.pkcs11.SunPKCS11");
Method configureMethod = sunPkcs11ProviderClass.getMethod("configure", String.class);
provider = (Provider) configureMethod.invoke(prototype, config);
} finally {
if (provider == null) {
useProvider = false;
} else {
SunPKCS11CipherFactory.provider = provider;
}
}
}
return provider;
}
/**
* Initializes a new instance of this class.
*
* @throws Exception if anything goes wrong while initializing a new
* instance
*/
public SunPKCS11CipherFactory() throws Exception {
super(getProvider());
logger.info("Created SunPKCS11 provider");
}
}
The method finalize on java.lang.Object
has been deprecated in java 9.
It is used here in the codebase:
https://github.com/jitsi/jitsi-srtp/blob/master/src/main/java/org/jitsi/srtp/crypto/OpenSslHmac.java#L164-L184
We should think about replacing the method. Oracle recommends
https://docs.oracle.com/javase/9/docs/api/java/lang/ref/Cleaner.html
and
https://docs.oracle.com/javase/8/docs/api/java/lang/ref/PhantomReference.html
as a replacement.
Note that Cleaner
is only available from java 9+, so I guess we can't use that as long as jitsi is supposed to work with java 8 but it would still be good to have a plan ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.