com.unbound.provider.kmip.attribute.KeyWrappingData 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.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;
/**
* Created by valery.osheter on 14-Nov-16.
*/
public class KeyWrappingData extends Attribute
{
public int wrappingMethod = 0;
public KeyWrappingInfo encKey = null;
public KeyWrappingInfo macKey = null;
public byte[] mac = null;
public byte[] iv = null;
public Integer encodingOption = null;
public KeyWrappingData()
{
super(KMIP.Tag.KeyWrappingData);
}
public void convert(KMIPConverter converter) throws KMIPConvertException
{
int begin = converter.convertBegin(KMIP.Tag.KeyWrappingData);
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);
}
mac = converter.convertOptional(KMIP.Tag.MacSignature, mac);
iv = converter.convertOptional(KMIP.Tag.IVCounterNonce, iv);
encodingOption = converter.convertOptional(KMIP.Tag.EncodingOption, encodingOption);
converter.convertEnd(begin);
}
public void log()
{
Log log = Log.func("KeyWrappingData").
log("wrappingMethod", wrappingMethod).
log("encodingOption", encodingOption).
logLen("macLen", mac).
logLen("ivLen", mac).
end();
if (encKey!=null) encKey.log();
if (macKey!=null) macKey.log();
log.leave();
}
}