use of com.android.org.conscrypt.TrustedCertificateIndex in project platform_frameworks_base by android.
the class ResourceCertificateSource method ensureInitialized.
private void ensureInitialized() {
synchronized (mLock) {
if (mCertificates != null) {
return;
}
Set<X509Certificate> certificates = new ArraySet<X509Certificate>();
Collection<? extends Certificate> certs;
InputStream in = null;
try {
CertificateFactory factory = CertificateFactory.getInstance("X.509");
in = mContext.getResources().openRawResource(mResourceId);
certs = factory.generateCertificates(in);
} catch (CertificateException e) {
throw new RuntimeException("Failed to load trust anchors from id " + mResourceId, e);
} finally {
IoUtils.closeQuietly(in);
}
TrustedCertificateIndex indexLocal = new TrustedCertificateIndex();
for (Certificate cert : certs) {
certificates.add((X509Certificate) cert);
indexLocal.index((X509Certificate) cert);
}
mCertificates = certificates;
mIndex = indexLocal;
mContext = null;
}
}
use of com.android.org.conscrypt.TrustedCertificateIndex in project android_frameworks_base by AOSPA.
the class ResourceCertificateSource method ensureInitialized.
private void ensureInitialized() {
synchronized (mLock) {
if (mCertificates != null) {
return;
}
Set<X509Certificate> certificates = new ArraySet<X509Certificate>();
Collection<? extends Certificate> certs;
InputStream in = null;
try {
CertificateFactory factory = CertificateFactory.getInstance("X.509");
in = mContext.getResources().openRawResource(mResourceId);
certs = factory.generateCertificates(in);
} catch (CertificateException e) {
throw new RuntimeException("Failed to load trust anchors from id " + mResourceId, e);
} finally {
IoUtils.closeQuietly(in);
}
TrustedCertificateIndex indexLocal = new TrustedCertificateIndex();
for (Certificate cert : certs) {
certificates.add((X509Certificate) cert);
indexLocal.index((X509Certificate) cert);
}
mCertificates = certificates;
mIndex = indexLocal;
mContext = null;
}
}
use of com.android.org.conscrypt.TrustedCertificateIndex in project android_frameworks_base by ResurrectionRemix.
the class ResourceCertificateSource method ensureInitialized.
private void ensureInitialized() {
synchronized (mLock) {
if (mCertificates != null) {
return;
}
Set<X509Certificate> certificates = new ArraySet<X509Certificate>();
Collection<? extends Certificate> certs;
InputStream in = null;
try {
CertificateFactory factory = CertificateFactory.getInstance("X.509");
in = mContext.getResources().openRawResource(mResourceId);
certs = factory.generateCertificates(in);
} catch (CertificateException e) {
throw new RuntimeException("Failed to load trust anchors from id " + mResourceId, e);
} finally {
IoUtils.closeQuietly(in);
}
TrustedCertificateIndex indexLocal = new TrustedCertificateIndex();
for (Certificate cert : certs) {
certificates.add((X509Certificate) cert);
indexLocal.index((X509Certificate) cert);
}
mCertificates = certificates;
mIndex = indexLocal;
mContext = null;
}
}
use of com.android.org.conscrypt.TrustedCertificateIndex in project android_frameworks_base by ResurrectionRemix.
the class KeyStoreCertificateSource method ensureInitialized.
private void ensureInitialized() {
synchronized (mLock) {
if (mCertificates != null) {
return;
}
try {
TrustedCertificateIndex localIndex = new TrustedCertificateIndex();
Set<X509Certificate> certificates = new ArraySet<>(mKeyStore.size());
for (Enumeration<String> en = mKeyStore.aliases(); en.hasMoreElements(); ) {
String alias = en.nextElement();
X509Certificate cert = (X509Certificate) mKeyStore.getCertificate(alias);
if (cert != null) {
certificates.add(cert);
localIndex.index(cert);
}
}
mIndex = localIndex;
mCertificates = certificates;
} catch (KeyStoreException e) {
throw new RuntimeException("Failed to load certificates from KeyStore", e);
}
}
}
use of com.android.org.conscrypt.TrustedCertificateIndex in project android_frameworks_base by crdroidandroid.
the class KeyStoreCertificateSource method ensureInitialized.
private void ensureInitialized() {
synchronized (mLock) {
if (mCertificates != null) {
return;
}
try {
TrustedCertificateIndex localIndex = new TrustedCertificateIndex();
Set<X509Certificate> certificates = new ArraySet<>(mKeyStore.size());
for (Enumeration<String> en = mKeyStore.aliases(); en.hasMoreElements(); ) {
String alias = en.nextElement();
X509Certificate cert = (X509Certificate) mKeyStore.getCertificate(alias);
if (cert != null) {
certificates.add(cert);
localIndex.index(cert);
}
}
mIndex = localIndex;
mCertificates = certificates;
} catch (KeyStoreException e) {
throw new RuntimeException("Failed to load certificates from KeyStore", e);
}
}
}
Aggregations