// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.its;

import org.bouncycastle.oer.its.ieee1609dot2.basetypes.HashedId8;
import org.bouncycastle.oer.its.ieee1609dot2.PKRecipientInfo;
import org.bouncycastle.oer.its.ieee1609dot2.RecipientInfo;

public class ETSIRecipientInfoBuilder
{
    private final ETSIKeyWrapper keyWrapper;
    private final byte[] recipientID;
    
    public ETSIRecipientInfoBuilder(final ETSIKeyWrapper keyWrapper, final byte[] recipientID) {
        this.keyWrapper = keyWrapper;
        this.recipientID = recipientID;
    }
    
    public RecipientInfo build(final byte[] array) {
        try {
            return RecipientInfo.certRecipInfo(PKRecipientInfo.builder().setRecipientId(new HashedId8(this.recipientID)).setEncKey(this.keyWrapper.wrap(array)).createPKRecipientInfo());
        }
        catch (final Exception cause) {
            throw new RuntimeException(cause.getMessage(), cause);
        }
    }
}
