feat: scripts
This commit is contained in:
19
scripts/generate_ecp256_keypair.js
Normal file
19
scripts/generate_ecp256_keypair.js
Normal file
@@ -0,0 +1,19 @@
|
||||
#! /usr/bin/env runjs
|
||||
|
||||
requireJAR('maven:me.hatter:crypto:1.9');
|
||||
|
||||
var KeyPairTool = Packages.me.hatter.tools.commons.security.key.KeyPairTool;
|
||||
var PKType = Packages.me.hatter.tools.commons.security.key.PKType;
|
||||
var PEMUtil = Packages.me.hatter.tools.commons.security.pem.PEMUtil;
|
||||
|
||||
|
||||
var main = () => {
|
||||
var kp = KeyPairTool.ins(PKType.secp256r1).generateKeyPair().getKeyPair();
|
||||
var privatePem = PEMUtil.printPEM("PRIVATE KEY", kp.getPrivate().getEncoded());
|
||||
var publicPem = PEMUtil.printPEM("PUBLIC KEY", kp.getPublic().getEncoded());
|
||||
println("[OK] Private key PEM:\n" + privatePem);
|
||||
println("[OK] Public key PEM:\n" + publicPem);
|
||||
};
|
||||
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user