-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for X25519 algorithm alias to XDH
* Added X25519 aliases for KeyPairGenerator, KeyFactory, and KeyAgreement in OpenSSLProvider
- Loading branch information
1 parent
8b379a7
commit 9ec5c8e
Showing
7 changed files
with
106 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
common/src/test/java/org/conscrypt/java/security/KeyFactoryTestX25519.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2019 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.conscrypt.java.security; | ||
|
||
import java.security.KeyPair; | ||
import java.security.NoSuchAlgorithmException; | ||
import java.security.spec.InvalidKeySpecException; | ||
import java.security.spec.PKCS8EncodedKeySpec; | ||
import java.security.spec.X509EncodedKeySpec; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
import tests.util.ServiceTester; | ||
|
||
@RunWith(JUnit4.class) | ||
public class KeyFactoryTestX25519 extends KeyFactoryTestXDH { | ||
|
||
public KeyFactoryTestX25519() { | ||
super("X25519"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
common/src/test/java/org/conscrypt/javax/crypto/X25519KeyAgreementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.conscrypt.javax.crypto; | ||
|
||
import static org.junit.Assert.assertArrayEquals; | ||
|
||
import java.security.KeyFactory; | ||
import java.security.PrivateKey; | ||
import java.security.Provider; | ||
import java.security.PublicKey; | ||
import java.security.Security; | ||
import java.security.spec.PKCS8EncodedKeySpec; | ||
import java.security.spec.X509EncodedKeySpec; | ||
import javax.crypto.KeyAgreement; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
|
||
|
||
/** | ||
* Tests for all registered X25519 {@link KeyAgreement} providers. | ||
*/ | ||
@RunWith(JUnit4.class) | ||
public class X25519KeyAgreementTest extends XDHKeyAgreementTest { | ||
|
||
@Override | ||
protected String getAlgorithm() { | ||
return "X25519"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters