Comments (6)
private static AuthorityKeyIdentifier createAuthorityKeyIdentifier(
PublicKey publicKey, org.bouncycastle.asn1.x500.X500Name dnName,
BigInteger serialNumber) {
GeneralName genName = new GeneralName(dnName);
SubjectPublicKeyInfo info;
try {
info = new SubjectPublicKeyInfo((ASN1Sequence) new ASN1InputStream(
publicKey.getEncoded()).readObject());
} catch (IOException e) {
throw new RuntimeException("Error encoding public key");
}
return new AuthorityKeyIdentifier(info, new GeneralNames(genName),
serialNumber);
}
here
from connect-sdk-android.
from connect-sdk-android.
@locnvbetasoft I did the same as in the instructions you sent but I don't know why when I connect to Android TV using webSocket it goes into onFailure and shows the error that there are no trusted certificates
Do you have a github link for detailed instructions in java or kotlin on this issue? Thanks you very much.
from connect-sdk-android.
You must create a certificate that can use bouncycastle
public static X509Certificate generateX509V3Certificate(KeyPair pair,
String name, Date notBefore, Date notAfter, BigInteger serialNumber)
throws GeneralSecurityException {
java.security.Security
.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
org.bouncycastle.x509.X509V3CertificateGenerator certGen = new org.bouncycastle.x509.X509V3CertificateGenerator();
X500Name dnName = new org.bouncycastle.asn1.x500.X500Name(name);
X500Principal principal = new X500Principal(name);
certGen.setSerialNumber(serialNumber);
// certGen.setIssuerDN(dnName);
// certGen.setSubjectDN(dnName); // note: same as issuer
certGen.setIssuerDN(principal);
certGen.setSubjectDN(principal);
certGen.setNotBefore(notBefore);
certGen.setNotAfter(notAfter);
certGen.setPublicKey(pair.getPublic());
certGen.setSignatureAlgorithm("SHA256WithRSAEncryption");
certGen.addExtension(X509Extension.basicConstraints, true,
new BasicConstraints(false));
certGen.addExtension(X509Extension.keyUsage, true, new KeyUsage(
KeyUsage.digitalSignature | KeyUsage.keyEncipherment
| KeyUsage.keyCertSign));
certGen.addExtension(X509Extension.extendedKeyUsage, true,
new ExtendedKeyUsage(KeyPurposeId.id_kp_serverAuth));
AuthorityKeyIdentifier authIdentifier = createAuthorityKeyIdentifier(
pair.getPublic(), dnName, serialNumber);
certGen.addExtension(X509Extension.authorityKeyIdentifier, true,
authIdentifier);
// certGen.addExtension(X509Extension.subjectKeyIdentifier, true,
// new SubjectKeyIdentifier(pair.getPublic()));
certGen.addExtension(X509Extension.subjectAlternativeName, false,
new GeneralNames(new GeneralName(GeneralName.rfc822Name,
"[email protected]")));
// This method is deprecated, but Android Eclair does not provide the
// generate() methods.
X509Certificate cert = certGen.generate(pair.getPrivate());
return cert;
}
public static X509Certificate generateX509V3Certificate(KeyPair pair,
String name) throws GeneralSecurityException {
Calendar calendar = Calendar.getInstance();
calendar.set(2009, 0, 1);
Date notBefore = new Date(calendar.getTimeInMillis());
calendar.set(2099, 0, 1);
Date notAfter = new Date(calendar.getTimeInMillis());
BigInteger serialNumber = BigInteger.valueOf(Math.abs(System
.currentTimeMillis()));
return generateX509V3Certificate(pair, name, notBefore, notAfter,
serialNumber);
}
from connect-sdk-android.
@locnvbetasoft Are you Vietnamese?
Can you send me the detailed content in this function?
createAuthorityKeyIdentifier(pair.getPublic(), dnName, serialNumber);
from connect-sdk-android.
@locnvbetasoft Can you send me the code that uses this certificate? Thank you very much
from connect-sdk-android.
Related Issues (20)
- Is there a way to launch the LG app store directly on some app?
- Im getting issues only in firestick device SimplePlayerException(error:com.amazon.whisperlink.service.fling.media.SimplePlayerError@c6763c0, message:Requires ACCESS_HDMI_SERVICE_ADVANCED permission) HOT 3
- Why Chromecast is not discovered on the First Attempt and always when App is reopened HOT 4
- Does the library use some Tracking link? HOT 9
- HTTPS video play on DLN getting error HOT 1
- Not able to include module in exists project HOT 5
- App freeze on network change HOT 1
- Internel Server Error when Video pause and Play in Samsung
- Library conflict with Web socket HOT 2
- Video play pause not working in samsung (DLNA) HOT 2
- Sample code for remote control
- No description provided. Delete
- Exception java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/safeparcel/zza; HOT 20
- Get icon of installed apps on WebOS TV LG kotlin HOT 19
- Photo/video rotation roku
- i can't remote in sony TV
- How to connect android application to samsung TV without it asking for authentication?
- 'java.lang.String java.net.Inet4Address.getHostAddress()' on a null object reference
- Im getting issues only in firestick device java.util.concurrent.ExecutionException: java.io.IOException: Cannot set Url on media device
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect-sdk-android.