GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add test for OpenJdkSelfSignedCertGenerator (#15619) (#15621) · netty/netty@1b2adac

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • handler/src/test/java/io/netty/handler/ssl/util
    • OpenJdkSelfSignedCertGeneratorTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎handler/src/test/java/io/netty/handler/ssl/util/OpenJdkSelfSignedCertGeneratorTest.java‎

Copy file name to clipboard
+47Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2025 The Netty Project
3+
*
4+
* The Netty Project licenses this file to you under the Apache License,
5+
* version 2.0 (the "License"); you may not use this file except in compliance
6+
* with the License. You may obtain a copy of the License at:
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations
14+
* under the License.
15+
*/
16+
17+
package io.netty.handler.ssl.util;
18+
19+
import org.junit.jupiter.api.Test;
20+
import org.junit.jupiter.api.condition.EnabledOnJre;
21+
import org.junit.jupiter.api.condition.JRE;
22+
23+
import java.security.KeyPair;
24+
import java.security.KeyPairGenerator;
25+
import java.security.SecureRandom;
26+
import java.util.Date;
27+
28+
import static org.junit.jupiter.api.Assertions.assertEquals;
29+
import static org.junit.jupiter.api.Assertions.assertNotEquals;
30+
31+
public class OpenJdkSelfSignedCertGeneratorTest {
32+
33+
@Test
34+
@EnabledOnJre({ JRE.JAVA_8, JRE.JAVA_9, JRE.JAVA_10, JRE.JAVA_11 })
35+
public void testGenerate() throws Exception {
36+
SecureRandom random = new SecureRandom();
37+
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
38+
keyGen.initialize(2048, random);
39+
KeyPair keypair = keyGen.generateKeyPair();
40+
41+
String[] generated = OpenJdkSelfSignedCertGenerator.generate("netty.io", keypair, random,
42+
new Date(), new Date(253402300799000L), "RSA");
43+
assertEquals(2, generated.length);
44+
assertNotEquals(0, generated[0].length());
45+
assertNotEquals(0, generated[1].length());
46+
}
47+
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.