This commit is contained in:
David Solin
2016-08-12 20:03:08 -05:00
parent df710d8dc9
commit 09616c4834
2 changed files with 6 additions and 5 deletions

View File

@@ -34,8 +34,8 @@ classes: classdirs $(CLASS_FILES)
install: all
cp sshj.jar $(TOP)/../jOVAL-Commercial/components/wsmv/winrs/rsrc/lib
# cp sshj.jar $(TOP)/../jOVAL-Commercial/components/provider/remote/rsrc/lib
# cp sshj.jar $(TOP)/../jOVAL-Commercial/components/sdk/dist/3rd-party
cp sshj.jar $(TOP)/../jOVAL-Commercial/components/provider/remote/rsrc/lib
cp sshj.jar $(TOP)/../jOVAL-Commercial/components/sdk/dist/3rd-party
classdirs: $(foreach pkg, $(PACKAGEDIRS), $(BUILD)/$(pkg)/)

View File

@@ -198,6 +198,8 @@ public class PKCS8KeyFile
CharBuffer cb = CharBuffer.wrap(pwdf.reqPassword(resource));
ByteBuffer bb = IOUtils.UTF8.encode(cb);
byte[] passphrase = Arrays.copyOfRange(bb.array(), bb.position(), bb.limit());
Arrays.fill(cb.array(), '\u0000');
Arrays.fill(bb.array(), (byte)0);
byte[] key = new byte[cipher.getBlockSize()];
iv = Arrays.copyOfRange(iv, 0, cipher.getIVSize());
Digest md5 = new MD5();
@@ -215,13 +217,12 @@ public class PKCS8KeyFile
System.arraycopy(tmp, 0, hn, i, tmp.length);
i += tmp.length;
}
Arrays.fill(passphrase, (byte)0);
System.arraycopy(hn, 0, key, 0, key.length);
cipher.init(Cipher.Mode.Decrypt, key, iv);
Arrays.fill(key, (byte)0);
cipher.update(data, 0, data.length);
decrypted = 0x30 == data[0];
Arrays.fill(cb.array(), '\u0000');
Arrays.fill(bb.array(), (byte) 0);
Arrays.fill(key, (byte) 0);
} while (!decrypted && pwdf.shouldRetry(resource));
}
if (0x30 != data[0]) {