Atavism Version 2018.1AGIS API

atavism.server.util
Class SecureTokenUtil

java.lang.Object
  extended by atavism.server.util.SecureTokenUtil

public class SecureTokenUtil
extends java.lang.Object

Some utility functions for key generation and encoding. They are all static and objects of this class should never be instantiated.


Method Summary
static byte[] encodeDomainKey(long keyId, javax.crypto.SecretKey key)
          Encode a key as a byte array for transmission over a network connection.
static byte[] encodeMasterPrivateKey(long keyId, java.security.PrivateKey privKey)
          Encode a master private key for storage.
static byte[] encodeMasterPublicKey(long keyId, java.security.PublicKey pubKey)
          Encode a master public key for storage.
static javax.crypto.SecretKey generateDomainKey()
          Generate a key to be used as the domain key.
static java.security.KeyPair generateMasterKeyPair()
          Generate a public/private keypair to be used as a master key.
static void main(java.lang.String[] args)
          Generate a new master key with the id specified in args
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generateDomainKey

public static javax.crypto.SecretKey generateDomainKey()
Generate a key to be used as the domain key. This should only be called by the domain server.


encodeDomainKey

public static byte[] encodeDomainKey(long keyId,
                                     javax.crypto.SecretKey key)
Encode a key as a byte array for transmission over a network connection. This is used by the domain server to prepare the domain key for transmission to other servers.


generateMasterKeyPair

public static java.security.KeyPair generateMasterKeyPair()
Generate a public/private keypair to be used as a master key.


encodeMasterPrivateKey

public static byte[] encodeMasterPrivateKey(long keyId,
                                            java.security.PrivateKey privKey)
Encode a master private key for storage. This can be base64 encoded and placed in a property file.


encodeMasterPublicKey

public static byte[] encodeMasterPublicKey(long keyId,
                                           java.security.PublicKey pubKey)
Encode a master public key for storage. This can be base64 encoded and placed in a property file.


main

public static void main(java.lang.String[] args)
Generate a new master key with the id specified in args



Copyright © 2018 Dragonsan Studios Sp. z o.o.