All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.unbound.provider.kmip.attribute.ServerInfo Maven / Gradle / Ivy

Go to download

This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi

There is a newer version: 42761
Show newest version
package com.unbound.provider.kmip.attribute;

import com.unbound.common.Log;
import com.unbound.provider.kmip.KMIP;
import com.unbound.provider.kmip.KMIPConvertException;
import com.unbound.provider.kmip.KMIPConverter;

import java.util.ArrayList;

/**
 * Created by valery.osheter on 26-Nov-15.
 */
public class ServerInfo
{
  public String version = "2.0";
  public String serverName = "";
  public String clientName = "";
  public String roleName = "";
  public String currentPartition = "";
  public Long lastActivity;
  public ArrayList partitions = new ArrayList<>();
  public ArrayList algs = new ArrayList();
  public ArrayList signAlgs = new ArrayList();
  public ArrayList hashAlgs = new ArrayList();
  public ArrayList blockCipherModes = new ArrayList();
  public ArrayList paddings = new ArrayList();

  public void convert(KMIPConverter converter) throws KMIPConvertException
  {
    int begin = converter.convertBegin(KMIP.Tag.ServerInformation);
    converter.convert(KMIP.Tag.DyPartition, currentPartition);
    converter.convert(KMIP.Tag.DyClient, clientName);
    converter.convert(KMIP.Tag.DyServerName, serverName);
    converter.convertStrList(KMIP.Tag.DyPartitionName, partitions);
    converter.convertIntList(KMIP.Tag.CryptographicAlgorithm, algs);
    converter.convertIntList(KMIP.Tag.DigitalSignatureAlgorithm, signAlgs);
    converter.convertIntList(KMIP.Tag.HashingAlgorithm, hashAlgs);
    converter.convertIntList(KMIP.Tag.BlockCipherMode, blockCipherModes);
    converter.convertIntList(KMIP.Tag.PaddingMethod, paddings);
    converter.convertOptional(KMIP.Tag.DyVersion, version);
    converter.convertOptional(KMIP.Tag.DyLastActivity, lastActivity);
    converter.convertOptional(KMIP.Tag.DyRole, roleName);
    converter.convertEnd(begin);
  }

  public void log()
  {
    Log log = Log.func("ServerInfo").
      log("version", version).
      log("serverName", serverName).
      log("clientName", clientName).
      log("currentPartition", currentPartition).
      log("lastActivity", lastActivity).
    end();
    if (partitions!=null) for (String partition : partitions) Log.print("Partition").log("name", partition).end();
    if (algs!=null) for (Integer alg : algs) Log.print("Algorithm").log("code", alg).end();
    if (signAlgs!=null) for (Integer alg : signAlgs) Log.print("Sign algorithm").log("code", alg).end();
    if (hashAlgs!=null) for (Integer alg : hashAlgs) Log.print("Hash algorithm").log("code", alg).end();
    if (blockCipherModes!=null) for (Integer mode : blockCipherModes) Log.print("Mode").log("code", mode).end();
    if (paddings!=null) for (Integer padding : paddings) Log.print("Padding").log("code", padding).end();
    log.leave();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy