Skip to content

Commit

Permalink
[README] Update Smack example: use setCustomX509TrustManager()
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Feb 17, 2022
1 parent 6559d9e commit ad65b1d
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,29 +48,26 @@ Pin Value: PLAIN:30820222300d06092a864886f70d01010105000382020f003082020a0282020


```java
SSLContext sc = JavaPinning
.forPin("SHA256:e3b1812d945da1a2a2c5fa28029d2fe34c7c4142fb098f5cfedff1ff20e98781");
X509TrustManager tm = Java7Pinning
.trustManagerForPin("SHA256:e3b1812d945da1a2a2c5fa28029d2fe34c7c4142fb098f5cfedff1ff20e98781");
```

Now you can setup this context.

Examples
--------

# [Smack](http://www.igniterealtime.org/projects/smack/) 4.0

```java
ConnectionConfiguration conf =
conf.setCustonSSLContext(sc);
```

# [Smack](http://www.igniterealtime.org/projects/smack/) 4.1
# [Smack](http://www.igniterealtime.org/projects/smack/)


```java
X509TrustManager tm = Java7Pinning
.trustManagerForPin("SHA256:e3b1812d945da1a2a2c5fa28029d2fe34c7c4142fb098f5cfedff1ff20e98781");
XMPPTCPConnectionConfiguration conf = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("user", "pass").setService("example.org")
.setCustomSSLContext(sc).build();
.setUsernameAndPassword("user", "pass")
.setService("example.org")
.setCustomX509TrustManager(tm)
.build()
```

How to add this as dependency
Expand All @@ -79,7 +76,7 @@ How to add this as dependency
### Gradle

```groovy
compile('eu.geekplace.javapinning:java-pinning-core:1.1.1')
compile('eu.geekplace.javapinning:java-pinning-core:1.2.0')
```

### Maven
Expand All @@ -88,7 +85,7 @@ compile('eu.geekplace.javapinning:java-pinning-core:1.1.1')
<dependency>
<groupId>eu.geekplace.javapinning</groupId>
<artifactId>java-pinning-core</artifactId>
<version>1.1.1</version>
<version>1.2.0</version>
</dependency>
```

Expand Down

0 comments on commit ad65b1d

Please sign in to comment.