blob: dc9690355e83a1df049a8a9e57bdb2ee16ebfae6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc.athenz.impl;
import org.bouncycastle.pkcs.PKCS10CertificationRequest;
import org.junit.Test;
import java.io.IOException;
import java.security.KeyPair;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;
/**
* @author bjorncs
*/
public class CryptoUtilsTest {
@Test
public void certificate_signing_request_is_correct_and_can_be_serialized_to_pem() throws IOException {
KeyPair keyPair = CryptoUtils.createKeyPair();
PKCS10CertificationRequest csr = CryptoUtils.createCSR(
"identity-domain", "identity-service", "vespa.cloud.com", "unique.instance.id", keyPair);
String pem = CryptoUtils.toPem(csr);
assertThat(pem, containsString("BEGIN CERTIFICATE REQUEST"));
assertThat(pem, containsString("END CERTIFICATE REQUEST"));
}
}
|