public class ZCert extends Object
To exchange certificates, send the public file via some secure route. Certificates are not signed but are text files that can be verified by eye.
Certificates are stored in the ZeroMQ Property Language format.
They have two sections, "metadata" and "curve".
The first contains a list of 'name = value' pairs, one per line.
Values may be enclosed in quotes.
The curve section has a 'public-key = key-value' and, for secret certificates, a
'secret-key = key-value' line.
The key-value is a Z85-encoded CURVE key.
| Constructor and Description |
|---|
ZCert() |
ZCert(byte[] publicKey,
byte[] secretKey) |
ZCert(String publicKey) |
ZCert(String publicKey,
String secretKey) |
ZCert(ZMQ.Curve.KeyPair keypair) |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(ZMQ.Socket socket) |
String |
getMeta(String key) |
ZMetadata |
getMetadata() |
byte[] |
getPublicKey() |
String |
getPublicKeyAsZ85() |
byte[] |
getSecretKey() |
String |
getSecretKeyAsZ85() |
File |
savePublic(String filename)
Saves the public key to a file.
|
void |
savePublic(Writer writer)
Saves the public key to a writer.
|
File |
saveSecret(String filename)
Saves the public and secret keys to a file.
|
void |
saveSecret(Writer writer)
Saves the public and secret keys to a writer.
|
void |
setMeta(String key,
String value) |
void |
unsetMeta(String key) |
public ZCert()
public ZCert(String publicKey)
public ZCert(ZMQ.Curve.KeyPair keypair)
public ZCert(byte[] publicKey,
byte[] secretKey)
public byte[] getPublicKey()
public byte[] getSecretKey()
public String getPublicKeyAsZ85()
public String getSecretKeyAsZ85()
public void apply(ZMQ.Socket socket)
public ZMetadata getMetadata()
public void unsetMeta(String key)
public File savePublic(String filename) throws IOException
This method will overwrite contents of existing file
filename - the path of the file to save the certificate into.IOException - if unable to save the file.public void savePublic(Writer writer) throws IOException
writer - the writer to save the certificate into.IOException - if unable to dump the public configuration.public File saveSecret(String filename) throws IOException
This method will overwrite contents of existing file
filename - the path of the file to save the certificate into.IOException - if unable to save the file.public void saveSecret(Writer writer) throws IOException
writer - the writer to save the certificate into.IOException - if unable to dump the configuration.Copyright © 2020. All rights reserved.