本文整理汇总了Java中org.shredzone.acme4j.util.KeyPairUtils类的典型用法代码示例。如果您正苦于以下问题:Java KeyPairUtils类的具体用法?Java KeyPairUtils怎么用?Java KeyPairUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyPairUtils类属于org.shredzone.acme4j.util包,在下文中一共展示了KeyPairUtils类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadOrCreateUserKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
/**
* Loads a user key pair from {@value #USER_KEY_FILE}. If the file does not exist,
* a new key pair is generated and saved.
* <p>
* Keep this key pair in a safe place! In a production environment, you will not be
* able to access your account again if you should lose the key pair.
*
* @return User's {@link KeyPair}.
*/
private KeyPair loadOrCreateUserKeyPair() throws IOException {
if (USER_KEY_FILE.exists()) {
// If there is a key file, read it
try (FileReader fr = new FileReader(USER_KEY_FILE)) {
return KeyPairUtils.readKeyPair(fr);
}
} else {
// If there is none, create a new key pair and save it
KeyPair userKeyPair = KeyPairUtils.createKeyPair(KEY_SIZE);
try (FileWriter fw = new FileWriter(USER_KEY_FILE)) {
KeyPairUtils.writeKeyPair(userKeyPair, fw);
}
return userKeyPair;
}
}
示例2: loadOrCreateKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
private KeyPair loadOrCreateKeyPair(File file) throws IOException {
if (file.exists()) {
messages.add("loading keypair", LOG);
try (FileReader fr = new FileReader(file)) {
return KeyPairUtils.readKeyPair(fr);
}
} else {
return createKeyPair(file);
}
}
示例3: createKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
private KeyPair createKeyPair(File file) throws IOException {
messages.add("creating keypair", LOG);
KeyPair keyPair = KeyPairUtils.createKeyPair(2048);
try (FileWriter fw = new FileWriter(file)) {
KeyPairUtils.writeKeyPair(keyPair, fw);
}
return keyPair;
}
示例4: createKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
public static Future<KeyPair> createKeyPair(Vertx vertx, int keysize) {
Future<KeyPair> res = future();
vertx.executeBlocking(fut -> {
fut.complete(KeyPairUtils.createKeyPair(keysize));
}, res);
return res;
}
示例5: readKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
public static Future<KeyPair> readKeyPair(Vertx vertx, Buffer buf) {
Future<KeyPair> res = future();
vertx.executeBlocking(fut -> {
try {
fut.complete(KeyPairUtils.readKeyPair(new StringReader(buf.toString())));
} catch (IOException e) {
fut.fail(e);
}
}, res);
return res;
}
示例6: writeKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
public static Future<Buffer> writeKeyPair(Vertx vertx, KeyPair keyPair) {
Future<Buffer> res = future();
vertx.executeBlocking(fut -> {
try {
StringWriter sw = new StringWriter();
KeyPairUtils.writeKeyPair(keyPair, sw);
fut.complete(Buffer.buffer(sw.toString()));
} catch (IOException e) {
fut.fail(e);
}
}, res);
return res;
}
示例7: loadOrCreateDomainKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
/**
* Loads a domain key pair from {@value #DOMAIN_KEY_FILE}. If the file does not exist,
* a new key pair is generated and saved.
*
* @return Domain {@link KeyPair}.
*/
private KeyPair loadOrCreateDomainKeyPair() throws IOException {
if (DOMAIN_KEY_FILE.exists()) {
try (FileReader fr = new FileReader(DOMAIN_KEY_FILE)) {
return KeyPairUtils.readKeyPair(fr);
}
} else {
KeyPair domainKeyPair = KeyPairUtils.createKeyPair(KEY_SIZE);
try (FileWriter fw = new FileWriter(DOMAIN_KEY_FILE)) {
KeyPairUtils.writeKeyPair(domainKeyPair, fw);
}
return domainKeyPair;
}
}
示例8: loadOrCreateKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
/**
* Loads a key pair from specified file. If the file does not exist,
* a new key pair is generated and saved.
*
* @return {@link KeyPair}.
*/
private KeyPair loadOrCreateKeyPair(File file) throws IOException {
if (file.exists()) {
try (FileReader fr = new FileReader(file)) {
return KeyPairUtils.readKeyPair(fr);
}
} else {
KeyPair domainKeyPair = KeyPairUtils.createKeyPair(KEY_SIZE);
try (FileWriter fw = new FileWriter(file)) {
KeyPairUtils.writeKeyPair(domainKeyPair, fw);
}
return domainKeyPair;
}
}
示例9: readKeyPairFromPrivateKey
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
public static KeyPair readKeyPairFromPrivateKey(String filePath) throws IOException {
try (FileReader fr = new FileReader(filePath)) {
return KeyPairUtils.readKeyPair(fr);
}
}
示例10: createKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
/**
* Creates a fresh key pair.
*
* @return Created {@link KeyPair}, guaranteed to be unknown to the Pebble server
*/
protected KeyPair createKeyPair() {
return KeyPairUtils.createKeyPair(2048);
}
示例11: createKeyPair
import org.shredzone.acme4j.util.KeyPairUtils; //导入依赖的package包/类
/**
* Creates a fresh key pair.
*
* @return Created new {@link KeyPair}
*/
protected KeyPair createKeyPair() {
return KeyPairUtils.createKeyPair(2048);
}