Skip to content

Instantly share code, notes, and snippets.

View moxgeek's full-sized avatar
👁️
LESS IS MORE

MoxGeek moxgeek

👁️
LESS IS MORE
View GitHub Profile
@moxgeek
moxgeek / MoxGeekImageView.java
Last active June 8, 2020 11:47
image zoom in/out , double tap, pinch , drag for gallery with RecyclerView. use setRecyclerView to freez your recycler while performing any kind of zooming gestures.
package com.nexy.nexinun.voipapp.utils;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.RectF;
import android.util.AttributeSet;
@milhomem
milhomem / clientCert.android.java
Last active April 18, 2024 21:18
How to connect using Client Certificate in Android with OkHttp
KeyStore keyStore = KeyStore.getInstance("PKCS12");
FileInputStream clientCertificateContent = new FileInputStream("/path/to/publicAndPrivateKey.p12");
keyStore.load(clientCertificateContent, "private key password".toCharArray());
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(keyStore, "private key password".toCharArray());
FileInputStream myTrustedCAFileContent = new FileInputStream("/path/to/embedded/CA-Chain.pem");
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
X509Certificate myCAPublicKey = (X509Certificate) certificateFactory.generateCertificate(myTrustedCAFileContent);