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
ConstructorDescriptionCreates 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 void
after()
Deletes the generated self-signed certificate.protected void
before()
Generates a self-signed certificate.Returns the generated self-signedX509Certificate
.Returns the self-signed certificate file.Returns thePrivateKey
of 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
-Certificate
is not valid before this timenotAfter
-Certificate
is 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
-Certificate
is not valid before this timenotAfter
-Certificate
is not valid after this time
-
SelfSignedCertificateRule
Creates a new instance.- Parameters:
fqdn
- a fully qualified domain namerandom
- theSecureRandom
to 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
- theSecureRandom
to usebits
- the number of bits of the generated private keynotBefore
-Certificate
is not valid before this timenotAfter
-Certificate
is not valid after this time
-
-
Method Details
-
before
Generates a self-signed certificate.- Overrides:
before
in classExternalResource
- Throws:
Throwable
-
after
protected void after()Deletes the generated self-signed certificate.- Overrides:
after
in classExternalResource
-
certificate
Returns the generated self-signedX509Certificate
. -
certificateFile
Returns the self-signed certificate file. -
privateKey
Returns thePrivateKey
of the self-signed certificate. -
privateKeyFile
Returns the private key file of the self-signed certificate.
-