Class SelfSignedCertificateRule
java.lang.Object
org.junit.rules.ExternalResource
com.linecorp.armeria.testing.junit4.server.SelfSignedCertificateRule
- All Implemented Interfaces:
TestRule
A
TestRule that provides a temporary self-signed certificate.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.Creates a new instance.SelfSignedCertificateRule(String fqdn, SecureRandom random, int bits) Creates a new instance.SelfSignedCertificateRule(String fqdn, SecureRandom random, int bits, TemporalAccessor notBefore, TemporalAccessor notAfter) Creates a new instance.SelfSignedCertificateRule(String fqdn, TemporalAccessor notBefore, TemporalAccessor notAfter) Creates a new instance.SelfSignedCertificateRule(TemporalAccessor notBefore, TemporalAccessor notAfter) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()Deletes the generated self-signed certificate.protected voidbefore()Generates a self-signed certificate.Returns the generated self-signedX509Certificate.Returns the self-signed certificate file.Returns thePrivateKeyof the self-signed certificate.Returns the private key file of the self-signed certificate.Methods inherited from class org.junit.rules.ExternalResource
apply
-
Constructor Details
-
SelfSignedCertificateRule
public SelfSignedCertificateRule()Creates a new instance. -
SelfSignedCertificateRule
Creates a new instance.- Parameters:
notBefore-Certificateis not valid before this timenotAfter-Certificateis not valid after this time
-
SelfSignedCertificateRule
Creates a new instance.- Parameters:
fqdn- a fully qualified domain name
-
SelfSignedCertificateRule
public SelfSignedCertificateRule(String fqdn, TemporalAccessor notBefore, TemporalAccessor notAfter) Creates a new instance.- Parameters:
fqdn- a fully qualified domain namenotBefore-Certificateis not valid before this timenotAfter-Certificateis not valid after this time
-
SelfSignedCertificateRule
Creates a new instance.- Parameters:
fqdn- a fully qualified domain namerandom- theSecureRandomto usebits- the number of bits of the generated private key
-
SelfSignedCertificateRule
public SelfSignedCertificateRule(String fqdn, SecureRandom random, int bits, TemporalAccessor notBefore, TemporalAccessor notAfter) Creates a new instance.- Parameters:
fqdn- a fully qualified domain namerandom- theSecureRandomto usebits- the number of bits of the generated private keynotBefore-Certificateis not valid before this timenotAfter-Certificateis not valid after this time
-
-
Method Details
-
before
Generates a self-signed certificate.- Overrides:
beforein classExternalResource- Throws:
Throwable
-
after
protected void after()Deletes the generated self-signed certificate.- Overrides:
afterin classExternalResource
-
certificate
Returns the generated self-signedX509Certificate. -
certificateFile
Returns the self-signed certificate file. -
privateKey
Returns thePrivateKeyof the self-signed certificate. -
privateKeyFile
Returns the private key file of the self-signed certificate.
-