Skip to content

Commit

Permalink
Fix test error and clean up extra comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sp717 committed Aug 6, 2024
1 parent 7a66fd5 commit 5de699d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
5 changes: 0 additions & 5 deletions csrc/java_evp_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,6 @@ JNIEXPORT jbyteArray JNICALL Java_com_amazon_corretto_crypto_provider_EvpEdEcPri
CHECK_OPENSSL(bufLen > 0);

size_t bufLen2 = (size_t) bufLen;

// CBS cbs;
// CBS_init(&cbs, borrow.data(), borrow.len());
// change to parse private key method

CHECK_OPENSSL(EVP_PKEY_get_raw_private_key(key, privateKeyBuffer, &bufLen2) > 0);

result = env->NewByteArray(bufLen2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package com.amazon.corretto.crypto.provider;

import java.security.PrivateKey;
// import java.security.interfaces.EdECPrivateKey;
import java.util.Optional;

class EvpEdEcPrivateKey extends EvpEdEcKey implements PrivateKey {
Expand All @@ -29,7 +28,6 @@ public EvpEdEcPublicKey getPublicKey() {
return result;
}

// @Override
public Optional<byte[]> getBytes() {
byte[] bytes = privateKey;
if (bytes == null) {
Expand Down
9 changes: 0 additions & 9 deletions src/com/amazon/corretto/crypto/provider/EvpEdEcPublicKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
package com.amazon.corretto.crypto.provider;

import java.security.PublicKey;
// import java.security.interfaces.EdECPublicKey;
// import java.security.spec.EdECPoint;

class EvpEdEcPublicKey extends EvpEdEcKey implements PublicKey {
private static final long serialVersionUID = 1;

private static native byte[] getPublicKey(long ptr);

private volatile byte[] publicKey;
// private volatile EdECPoint point;

EvpEdEcPublicKey(final long ptr) {
this(new InternalKey(ptr));
Expand All @@ -21,10 +18,4 @@ class EvpEdEcPublicKey extends EvpEdEcKey implements PublicKey {
EvpEdEcPublicKey(final InternalKey key) {
super(key, true);
}

// @Override
// public EdECPoint getPoint() {
// return point;
// }

}
4 changes: 2 additions & 2 deletions tst/com/amazon/corretto/crypto/provider/test/EdDSATest.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ public void testNullInputs() throws GeneralSecurityException {
TestUtil.assertThrows(NullPointerException.class, () -> bcSig.update((byte[]) null));
// Test with null signature
bcSig.initVerify(keyPair2.getPublic());
assertTrue(NullPointerException.class, () -> bcSig.verify(null));
TestUtil.assertThrows(NullPointerException.class, () -> bcSig.verify(null));

// Test ACCP behavior
KeyPair keyPair3 = nativeGen.generateKeyPair();
Expand All @@ -330,6 +330,6 @@ public void testNullInputs() throws GeneralSecurityException {
TestUtil.assertThrows(NullPointerException.class, () -> nativeSig.update((byte[]) null));
// Test with null signature
nativeSig.initVerify(keyPair3.getPublic());
assertTrue(!nativeSig.verify(null));
TestUtil.assertThrows(NullPointerException.class, () -> nativeSig.verify(null));
}
}

0 comments on commit 5de699d

Please sign in to comment.