// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/CA.java
// public static CsrBuilder createCsr() {
//   return new CsrBuilderImpl();
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/CA.java
// public static RootCertificateBuilder createSelfSignedCertificate(
//     final DistinguishedName subject) {
//   return new RootCertificateBuilderImpl(subject);
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/CA.java
// public static DnBuilder dn() {
//   return new DnBuilderImpl();
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/CSR.java
// public interface CSR {
// 
//   public DistinguishedName getSubject();
// 
//   public PublicKey getPublicKey();
// 
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/DistinguishedName.java
// public interface DistinguishedName {
// 
//   public X500Name getX500Name();
// 
//   public X500Principal getX500Principal();
// 
//   public byte[] getEncoded();
// 
//   public String getName();
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/RootCertificate.java
// public interface RootCertificate extends CertificateWithPrivateKey {
// 
//   public Signer signCsr(final CSR request);
// 
// }


import static io.github.olivierlemasle.ca.CA.createCsr;
import static io.github.olivierlemasle.ca.CA.createSelfSignedCertificate;
import static io.github.olivierlemasle.ca.CA.dn;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.security.cert.CertificateExpiredException;
import java.security.cert.CertificateNotYetValidException;
import java.security.cert.X509Certificate;
import org.junit.Test;
import io.github.olivierlemasle.ca.CSR;
import io.github.olivierlemasle.ca.DistinguishedName;
import io.github.olivierlemasle.ca.RootCertificate;
package io.github.olivierlemasle.tests;





public class SignTest {

  @Test
  public void sign() {
    final DistinguishedName caName = dn("CN=CA-Test");
    final RootCertificate ca = createSelfSignedCertificate(caName).build();
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/CA.java
// public static CsrBuilder createCsr() {
//   return new CsrBuilderImpl();
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/CA.java
// public static RootCertificateBuilder createSelfSignedCertificate(
//     final DistinguishedName subject) {
//   return new RootCertificateBuilderImpl(subject);
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/CA.java
// public static DnBuilder dn() {
//   return new DnBuilderImpl();
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/CSR.java
// public interface CSR {
// 
//   public DistinguishedName getSubject();
// 
//   public PublicKey getPublicKey();
// 
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/DistinguishedName.java
// public interface DistinguishedName {
// 
//   public X500Name getX500Name();
// 
//   public X500Principal getX500Principal();
// 
//   public byte[] getEncoded();
// 
//   public String getName();
// }
// 
// Path: java-ca-lib/src/main/java/io/github/olivierlemasle/ca/RootCertificate.java
// public interface RootCertificate extends CertificateWithPrivateKey {
// 
//   public Signer signCsr(final CSR request);
// 
// }


// Path: java-ca-lib/src/test/java/io/github/olivierlemasle/tests/SignTest.java
import static io.github.olivierlemasle.ca.CA.createCsr;
import static io.github.olivierlemasle.ca.CA.createSelfSignedCertificate;
import static io.github.olivierlemasle.ca.CA.dn;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.security.cert.CertificateExpiredException;
import java.security.cert.CertificateNotYetValidException;
import java.security.cert.X509Certificate;
import org.junit.Test;
import io.github.olivierlemasle.ca.CSR;
import io.github.olivierlemasle.ca.DistinguishedName;
import io.github.olivierlemasle.ca.RootCertificate;

package io.github.olivierlemasle.tests;





public class SignTest {

  @Test
  public void sign() {
    final DistinguishedName caName = dn("CN=CA-Test");
    final RootCertificate ca = createSelfSignedCertificate(caName).build();
    final CSR csr = createCsr().generateRequest(dn("CN=test"));