Skip to content

Commit

Permalink
Change regex pattern at decodeKey() to not greedy
Browse files Browse the repository at this point in the history
  • Loading branch information
dtitov committed Feb 4, 2020
1 parent 28ac7a2 commit 5331694
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ To include this library to your Maven project add following to the `pom.xml`:
To install console app you can use the following script (assuming you are using `bash`):
```
PREFIX=/usr/local/bin && \
sudo curl -L "https://github.com/uio-bmi/crypt4gh/releases/download/v2.4.0/crypt4gh.jar" -o "$PREFIX/crypt4gh.jar" && \
sudo curl -L "https://github.com/uio-bmi/crypt4gh/releases/download/v2.4.1/crypt4gh.jar" -o "$PREFIX/crypt4gh.jar" && \
echo -e '#!/usr/bin/env bash\njava -jar' "$PREFIX/crypt4gh.jar" '$@' | sudo tee "$PREFIX/crypt4gh" > /dev/null && \
sudo chmod +x "$PREFIX/crypt4gh"
```
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>no.uio.ifi</groupId>
<artifactId>crypt4gh</artifactId>
<version>2.4.0</version>
<version>2.4.1</version>
<packaging>jar</packaging>

<name>crypt4gh</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/no/uio/ifi/crypt4gh/util/KeyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public PrivateKey readCrypt4GHPrivateKey(byte[] keyMaterial, char[] password) th
* @return Decoded key as byte array.
*/
public byte[] decodeKey(String keyMaterial) {
keyMaterial = keyMaterial.replaceAll("-----(.*)-----", "").replace(System.lineSeparator(), "").replace(" ", "").trim();
keyMaterial = keyMaterial.replaceAll("-----(.*?)-----", "").replace(System.lineSeparator(), "").replace(" ", "").trim();
return Base64.getDecoder().decode(keyMaterial);
}

Expand Down

0 comments on commit 5331694

Please sign in to comment.