com.unbound.provider.kmip.request.CreateKeyPairRequest 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.request;
import com.unbound.common.Log;
import com.unbound.provider.kmip.KMIP;
import com.unbound.provider.kmip.KMIPConvertException;
import com.unbound.provider.kmip.KMIPConverter;
import com.unbound.provider.kmip.attribute.Attribute;
import com.unbound.provider.kmip.attribute.TemplateAttribute;
/**
* Created by valery.osheter on 26-Nov-15.
*/
public class CreateKeyPairRequest extends RequestItem
{
public TemplateAttribute common = null;
public TemplateAttribute prv = null;
public TemplateAttribute pub = null;
public CreateKeyPairRequest()
{
super(KMIP.Operation.CreateKeyPair);
}
public void convert(KMIPConverter converter) throws KMIPConvertException
{
if (converter.isRead() && converter.getNextTag() == KMIP.Tag.CommonTemplateAttribute)
common = new TemplateAttribute();
if (common != null)
{
common.tag = KMIP.Tag.CommonTemplateAttribute;
common.convert(converter);
}
if (converter.isRead() && converter.getNextTag() == KMIP.Tag.PrivateKeyTemplateAttribute)
prv = new TemplateAttribute();
if (prv != null)
{
prv.tag = KMIP.Tag.PrivateKeyTemplateAttribute;
prv.convert(converter);
}
if (converter.isRead() && converter.getNextTag() == KMIP.Tag.PublicKeyTemplateAttribute)
pub = new TemplateAttribute();
if (pub != null)
{
pub.tag = KMIP.Tag.PublicKeyTemplateAttribute;
pub.convert(converter);
}
}
public void addCommonAttribute(Attribute attribute)
{
if (common == null)
common = new TemplateAttribute(KMIP.Tag.CommonTemplateAttribute);
common.attrs.add(attribute);
}
public void addPublicKeyAttribute(Attribute attribute)
{
if (pub == null)
pub = new TemplateAttribute(KMIP.Tag.PublicKeyTemplateAttribute);
pub.attrs.add(attribute);
}
public void addPrivateKeyAttribute(Attribute attribute)
{
if (prv == null)
prv = new TemplateAttribute(KMIP.Tag.PrivateKeyTemplateAttribute);
prv.attrs.add(attribute);
}
public void log()
{
Log log = Log.func("CreateKeyPairRequest").end();
if (common!=null) common.log();
if (pub!=null) pub.log();
if (prv!=null) prv.log();
log.leave();
}
}