com.unbound.kmip.attribute.KeyWrappingSpec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unbound-java-provider Show documentation
Show all versions of unbound-java-provider Show documentation
This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi
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;
import java.util.ArrayList;
/**
* Created by valery.osheter on 14-Nov-16.
*/
public class KeyWrappingSpec
{
public int wrappingMethod = 0;
public KeyWrappingInfo encKey = null;
public KeyWrappingInfo macKey = null;
public ArrayList attrNames = new ArrayList();
public Integer encodingOption = null;
public void convert(KMIPConverter converter) throws KMIPConvertException
{
int begin = converter.convertBegin(KMIP.Tag.KeyWrappingSpecification);
wrappingMethod = converter.convert(KMIP.Tag.WrappingMethod, wrappingMethod);
if (!converter.isWrite() && converter.getNextTag() == KMIP.Tag.EncryptionKeyInformation)
encKey = new KeyWrappingInfo();
if (encKey != null)
{
int b = converter.convertBegin(KMIP.Tag.EncryptionKeyInformation);
encKey.convert(converter);
converter.convertEnd(b);
}
if (!converter.isWrite() && converter.getNextTag() == KMIP.Tag.MacSignatureKeyInformation)
macKey = new KeyWrappingInfo();
if (macKey != null)
{
int b = converter.convertBegin(KMIP.Tag.MacSignatureKeyInformation);
macKey.convert(converter);
converter.convertEnd(b);
}
converter.convertStrList(KMIP.Tag.AttributeName, attrNames);
encodingOption = converter.convertOptional(KMIP.Tag.EncodingOption, encodingOption);
converter.convertEnd(begin);
}
public void log()
{
Log log = Log.func("KeyWrappingSpec").log("wrappingMethod", wrappingMethod).log("encodingOption", encodingOption).end();
for (String name : attrNames) Log.print("Attribute name").log("name", name).end();
if (encKey!=null) encKey.log();
if (macKey!=null) macKey.log();
log.leave();
}
}