Skip to content

Commit

Permalink
Reorganized Buildtools
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas authored and Andreas committed Feb 10, 2024
1 parent 7879d7c commit 85ac0ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="build_jar" name="Create all Jars for Project SshKeyFormats">
<property name="version" value="23.0.1" />
<loadfile property="version" srcFile="build.version" failonerror="false" />
<property name="version" value="noVersion" />

<property name="projectsPath" value="${user.home}/git" />
<echo message="projectsPath: ${projectsPath}" />
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/de/soderer/sshkeyformats/SshKeyReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@

import de.soderer.sshkeyformats.SshKey.SshKeyFormat;
import de.soderer.sshkeyformats.data.Asn1Codec;
import de.soderer.sshkeyformats.data.Asn1Codec.DerTag;
import de.soderer.sshkeyformats.data.BCryptPBKDF;
import de.soderer.sshkeyformats.data.OID;
import de.soderer.sshkeyformats.data.Password;
import de.soderer.sshkeyformats.data.WrongPasswordException;
import de.soderer.sshkeyformats.data.Asn1Codec.DerTag;

/**
* Reader for SSH public and private keys with optional password protection<br />
Expand Down Expand Up @@ -1140,9 +1140,13 @@ private static String toHexString(final byte[] data) {

private static byte[] removeLengthCodedPadding(final byte[] data) {
final int paddingSize = data[data.length - 1];
final byte[] dataUnpadded = new byte[data.length - paddingSize];
System.arraycopy(data, 0, dataUnpadded, 0, dataUnpadded.length);
return dataUnpadded;
if (paddingSize > 0) {
final byte[] dataUnpadded = new byte[data.length - paddingSize];
System.arraycopy(data, 0, dataUnpadded, 0, dataUnpadded.length);
return dataUnpadded;
} else {
return data;
}
}

private static SshKey readPuttyVersion2Key(final Map<String, String> keyProperties, final Password password, final boolean skipPrivateKey) throws Exception {
Expand Down

0 comments on commit 85ac0ae

Please sign in to comment.