Package org.acemq.amqp.security.dev
Class DevelopmentCertificates
java.lang.Object
org.acemq.amqp.security.dev.DevelopmentCertificates
Generates a throwaway certificate authority and the certificates a local broker and client
need, so that running with TLS on a developer's machine is one command rather than an
afternoon with
openssl.
Everything produced here carries ACEMQ DEVELOPMENT ONLY - DO NOT TRUST in its
subject, and AceMQ refuses such a certificate unless the policy explicitly calls
allowDevelopmentCertificates(). That is the point: a self-signed authority that drifts
into production is worse than no encryption, because everything looks protected and
nothing is verified. These fail closed instead.
Certificates are short-lived by default. A development certificate that never expires is one that outlives the reason it was created.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionWrites a CA, a broker certificate, a client certificate and the two keystores AceMQ reads.rabbitMqConfiguration(Path certificateDirectoryInContainer)
-
Field Details
-
MARKER
Written into every subject, and refused by the library unless explicitly allowed.- See Also:
-
-
Constructor Details
-
DevelopmentCertificates
public DevelopmentCertificates()
-
-
Method Details
-
generate
public DevelopmentCertificates.Result generate(Path directory, String brokerHost, char[] password, Duration validity) throws IOException, GeneralSecurityException Writes a CA, a broker certificate, a client certificate and the two keystores AceMQ reads.- Parameters:
directory- where to write them; created if absentbrokerHost- the host the broker will be reached at, which becomes the certificate's common name and a subject alternative namepassword- protects the generated keystoresvalidity- how long the certificates are good for- Returns:
- what was written
- Throws:
IOException- if the files cannot be writtenGeneralSecurityException- if the certificates cannot be generated
-
rabbitMqConfiguration
- Returns:
- a
rabbitmq.confthat serves TLS with whatgenerate(java.nio.file.Path, java.lang.String, char[], java.time.Duration)wrote
-