Skip to content

Commit

Permalink
Merge pull request #464 from norrisjeremy/20231222
Browse files Browse the repository at this point in the history
0.2.16 changes
  • Loading branch information
mwiede authored Jan 3, 2024
2 parents 866eab9 + 76f1bdb commit 18da51e
Show file tree
Hide file tree
Showing 19 changed files with 990 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
java-version: ${{ matrix.java }}
check-latest: true
- name: Test with Maven
run: ./mvnw -B -V -e -P coverage verify -Denforcer.skip=true -Dmaven.resources.skip=true -Dmaven.main.skip=true -Dassembly.skipAssembly=true -Dmaven.javadoc.skip=true -DskipITs=false
run: ./mvnw -B -V -e -P coverage verify -Denforcer.skip=true -Dmaven.resources.skip=true -Dmaven.main.skip=true -Dbnd.skip=true -Dassembly.skipAssembly=true -Dmaven.javadoc.skip=true -Dcyclonedx.skip=true -DskipITs=false
- uses: actions/upload-artifact@v4
with:
name: java-${{ matrix.java }}-testresults
Expand Down
75 changes: 52 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@
<timezone>+9</timezone>
</developer>
<developer>
<id>mwiede</id>
<name>Matthias Wiedemann</name>
<email>[email protected]</email>
<organization>Community</organization>
<organizationUrl>https://github.com/mwiede</organizationUrl>
</developer>
<developer>
<id>norrisjeremy</id>
<name>Jeremy Norris</name>
<organization>Community</organization>
<organizationUrl>https://github.com/norrisjeremy</organizationUrl>
Expand Down Expand Up @@ -254,7 +256,7 @@
<configuration>
<rules>
<requireJavaVersion>
<version>16</version>
<version>17</version>
</requireJavaVersion>
<dependencyConvergence />
<banDuplicatePomDependencyVersions />
Expand Down Expand Up @@ -403,31 +405,32 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.9</version>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>7.0.0</version>
<configuration>
<instructions>
<Export-Package>com.jcraft.jsch;-noimport:=true</Export-Package>
<Import-Package><![CDATA[
com.sun.jna*;version="${range;[=0,+)}",
org.apache.logging.log4j*;version="${range;[=0,4)}",
org.bouncycastle*;version="[1.76,${versionmask;+})",
org.slf4j*;version="[1.7,${versionmask;+})",
org.ietf.jgss;resolution:=optional,
<bnd><![CDATA[
-noextraheaders: false
-removeheaders: \
Bnd-LastModified,\
Bundle-Developers,\
Bundle-DocURL,\
Bundle-SCM,\
Created-By,\
Private-Package
Bundle-SymbolicName: ${project.groupId}.${project.artifactId}
Export-Package: com.jcraft.jsch;-noimport:=true
Import-Package: \
com.sun.jna*;version="${range;[=0,+)}";resolution:=optional,\
org.apache.logging.log4j*;version="${range;[=0,4)}";resolution:=optional,\
org.bouncycastle*;version="[1.76,${versionmask;+})";resolution:=optional,\
org.slf4j*;version="[1.7,${versionmask;+})";resolution:=optional,\
org.newsclub.net.unix;resolution:=optional,\
org.ietf.jgss;resolution:=optional,\
!java.*,\
*
]]></Import-Package>
</instructions>
]]></bnd>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -661,6 +664,9 @@
<bundledSignature>jdk-non-portable</bundledSignature>
<bundledSignature>jdk-reflection</bundledSignature>
</bundledSignatures>
<suppressAnnotations>
<suppressAnnotation>com.jcraft.jsch.annotations.SuppressForbiddenApi</suppressAnnotation>
</suppressAnnotations>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -859,5 +865,28 @@
</plugins>
</build>
</profile>
<profile>
<id>bnd</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<executions>
<execution>
<id>bnd-process</id>
<phase>process-classes</phase>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
38 changes: 38 additions & 0 deletions src/main/java/com/jcraft/jsch/DH25519SNTRUP761.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2015-2018 ymnk, JCraft,Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided with
* the distribution.
*
* 3. The names of the authors may not be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package com.jcraft.jsch;

class DH25519SNTRUP761 extends DHXECKEM {
public DH25519SNTRUP761() {
kem_name = "sntrup761";
sha_name = "sha-512";
curve_name = "X25519";
kem_pubkey_len = 1158;
kem_encap_len = 1039;
xec_key_len = 32;
}
}
5 changes: 2 additions & 3 deletions src/main/java/com/jcraft/jsch/DHECN.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ public boolean next(Buffer _buf) throws Exception {
return false;
}

K = ecdh.getSecret(r_s[0], r_s[1]);
K = normalize(K);
K = encodeAsMPInt(normalize(ecdh.getSecret(r_s[0], r_s[1])));

byte[] sig_of_H = _buf.getString();

Expand All @@ -159,11 +158,11 @@ public boolean next(Buffer _buf) throws Exception {
buf.putString(K_S);
buf.putString(Q_C);
buf.putString(Q_S);
buf.putMPInt(K);
byte[] foo = new byte[buf.getLength()];
buf.getByte(foo);

sha.update(foo, 0, foo.length);
sha.update(K, 0, K.length);
H = sha.digest();

i = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/jcraft/jsch/DHGEX.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public boolean next(Buffer _buf) throws Exception {

dh.checkRange();

K = normalize(dh.getK());
K = encodeAsMPInt(normalize(dh.getK()));

// The hash H is computed as the HASH hash of the concatenation of the
// following:
Expand Down Expand Up @@ -208,11 +208,11 @@ public boolean next(Buffer _buf) throws Exception {
buf.putMPInt(g);
buf.putMPInt(e);
buf.putMPInt(f);
buf.putMPInt(K);

byte[] foo = new byte[buf.getLength()];
buf.getByte(foo);
sha.update(foo, 0, foo.length);
sha.update(K, 0, K.length);

H = sha.digest();

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/jcraft/jsch/DHGN.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public boolean next(Buffer _buf) throws Exception {

dh.checkRange();

K = normalize(dh.getK());
K = encodeAsMPInt(normalize(dh.getK()));

// The hash H is computed as the HASH hash of the concatenation of the
// following:
Expand All @@ -156,10 +156,11 @@ public boolean next(Buffer _buf) throws Exception {
buf.putString(K_S);
buf.putMPInt(e);
buf.putMPInt(f);
buf.putMPInt(K);
byte[] foo = new byte[buf.getLength()];
buf.getByte(foo);

sha.update(foo, 0, foo.length);
sha.update(K, 0, K.length);
H = sha.digest();
// System.err.print("H -> "); //dump(H, 0, H.length);

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/jcraft/jsch/DHXEC.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ public boolean next(Buffer _buf) throws Exception {
return false;
}

K = xdh.getSecret(Q_S);
K = normalize(K);
K = encodeAsMPInt(normalize(xdh.getSecret(Q_S)));

byte[] sig_of_H = _buf.getString();

Expand Down Expand Up @@ -171,11 +170,11 @@ public boolean next(Buffer _buf) throws Exception {
buf.putString(K_S);
buf.putString(Q_C);
buf.putString(Q_S);
buf.putMPInt(K);
byte[] foo = new byte[buf.getLength()];
buf.getByte(foo);

sha.update(foo, 0, foo.length);
sha.update(K, 0, K.length);
H = sha.digest();

i = 0;
Expand Down
Loading

0 comments on commit 18da51e

Please sign in to comment.