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

com.unbound.kmip.attribute.Digest 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.kmip.attribute;

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

/**
 * Created by valery.osheter on 19-Nov-15.
 */
public class Digest extends Attribute
{

  public int hashingAlg = 0;
  public byte[] value = null;
  public Integer keyFormat = null;

  public Digest()
  {
    super(KMIP.Tag.Digest);
  }

  public Digest(byte[] value, int hashingAlg, Integer keyFormat)
  {
    this();
    this.value = value;
    this.hashingAlg = hashingAlg;
    this.keyFormat = keyFormat;
  }

  public void convert(KMIPConverter converter) throws KMIPConvertException
  {
    int begin = converter.convertBegin(KMIP.tagAttributeValue(KMIP.TagType.Structure));
    hashingAlg = converter.convert(KMIP.Tag.HashingAlgorithm, hashingAlg);
    value = converter.convertOptional(KMIP.Tag.DigestValue, value);
    keyFormat = converter.convertOptional(KMIP.Tag.KeyFormatType, keyFormat);
    converter.convertEnd(begin);
  }

  public void log()
  {
    Log.print("Digest").
      log("hashingAlg", hashingAlg).
      log("keyFormat", keyFormat).
      logLen("valueLen", value).
    end();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy