@@ -0,0 +1,3281 @@
+package org.bouncycastle.asn1.cms.ecc;%0A%0Aimport org.bouncycastle.asn1.ASN1Encodable;%0Aimport org.bouncycastle.asn1.ASN1EncodableVector;%0Aimport org.bouncycastle.asn1.ASN1OctetString;%0Aimport org.bouncycastle.asn1.ASN1Sequence;%0Aimport org.bouncycastle.asn1.ASN1TaggedObject;%0Aimport org.bouncycastle.asn1.DERObject;%0Aimport org.bouncycastle.asn1.DERSequence;%0Aimport org.bouncycastle.asn1.DERTaggedObject;%0Aimport org.bouncycastle.asn1.cms.OriginatorPublicKey;%0A%0Apublic class MQVuserKeyingMaterial%0A    extends ASN1Encodable%0A%7B%0A    private OriginatorPublicKey ephemeralPublicKey;%0A    private ASN1OctetString addedukm;%0A%0A    public MQVuserKeyingMaterial(%0A        OriginatorPublicKey ephemeralPublicKey,%0A        ASN1OctetString addedukm)%0A    %7B%0A        // TODO Check ephemeralPublicKey not null%0A        %0A        this.ephemeralPublicKey = ephemeralPublicKey;%0A        this.addedukm = addedukm;%0A    %7D%0A%0A    private MQVuserKeyingMaterial(%0A        ASN1Sequence seq)%0A    %7B%0A        // TODO Check seq has either 1 or 2 elements%0A%0A        this.ephemeralPublicKey = OriginatorPublicKey.getInstance(%0A            seq.getObjectAt(0));%0A%0A        if (seq.size() %3E 1)%0A        %7B%0A            this.addedukm = ASN1OctetString.getInstance(%0A                (ASN1TaggedObject)seq.getObjectAt(1), true);%0A        %7D%0A    %7D%0A%0A    /**%0A     * return an MQVuserKeyingMaterial object from a tagged object.%0A     *%0A     * @param obj      the tagged object holding the object we want.%0A     * @param explicit true if the object is meant to be explicitly%0A     *                 tagged false otherwise.%0A     * @throws IllegalArgumentException if the object held by the%0A     *                                  tagged object cannot be converted.%0A     */%0A    public static MQVuserKeyingMaterial getInstance(%0A        ASN1TaggedObject obj,%0A        boolean explicit)%0A    %7B%0A        return getInstance(ASN1Sequence.getInstance(obj, explicit));%0A    %7D%0A%0A    /**%0A     * return an MQVuserKeyingMaterial object from the given object.%0A     *%0A     * @param obj the object we want converted.%0A     * @throws IllegalArgumentException if the object cannot be converted.%0A     */%0A    public static MQVuserKeyingMaterial getInstance(%0A        Object obj)%0A    %7B%0A        if (obj == null %7C%7C obj instanceof MQVuserKeyingMaterial)%0A        %7B%0A            return (MQVuserKeyingMaterial)obj;%0A        %7D%0A%0A        if (obj instanceof ASN1Sequence)%0A        %7B%0A            return new MQVuserKeyingMaterial((ASN1Sequence)obj);%0A        %7D%0A%0A        throw new IllegalArgumentException(%22Invalid MQVuserKeyingMaterial: %22 + obj.getClass().getName());%0A    %7D%0A%0A    public OriginatorPublicKey getEphemeralPublicKey()%0A    %7B%0A        return ephemeralPublicKey;%0A    %7D%0A%0A    public ASN1OctetString getAddedukm()%0A    %7B%0A        return addedukm;%0A    %7D%0A%0A    /**%0A     * Produce an object suitable for an ASN1OutputStream.%0A     * %3Cpre%3E%0A     * MQVuserKeyingMaterial ::= SEQUENCE %7B%0A     *   ephemeralPublicKey OriginatorPublicKey,%0A     *   addedukm %5B0%5D EXPLICIT UserKeyingMaterial OPTIONAL  %7D%0A     * %3C/pre%3E%0A     */%0A    public DERObject toASN1Object()%0A    %7B%0A        ASN1EncodableVector v = new ASN1EncodableVector();%0A        v.add(ephemeralPublicKey);%0A%0A        if (addedukm != null)%0A        %7B%0A            v.add(new DERTaggedObject(true, 0, addedukm));%0A        %7D%0A%0A        return new DERSequence(v);%0A    %7D%0A%7D%0A

Add class used by CMS for encoding user keying material under ECMQV key agreement