summaryrefslogtreecommitdiffstats
path: root/bcprov/src/main/java/org/bouncycastle/asn1/cms/KeyAgreeRecipientInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/asn1/cms/KeyAgreeRecipientInfo.java')
-rw-r--r--bcprov/src/main/java/org/bouncycastle/asn1/cms/KeyAgreeRecipientInfo.java53
1 files changed, 33 insertions, 20 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/asn1/cms/KeyAgreeRecipientInfo.java b/bcprov/src/main/java/org/bouncycastle/asn1/cms/KeyAgreeRecipientInfo.java
index c6e5744..224932a 100644
--- a/bcprov/src/main/java/org/bouncycastle/asn1/cms/KeyAgreeRecipientInfo.java
+++ b/bcprov/src/main/java/org/bouncycastle/asn1/cms/KeyAgreeRecipientInfo.java
@@ -11,6 +11,22 @@ import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
+/**
+ * <a href="http://tools.ietf.org/html/rfc5652#section-6.2.2">RFC 5652</a>:
+ * Content encryption key delivery mechanisms.
+ * <p>
+ * <pre>
+ * KeyAgreeRecipientInfo ::= SEQUENCE {
+ * version CMSVersion, -- always set to 3
+ * originator [0] EXPLICIT OriginatorIdentifierOrKey,
+ * ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
+ * keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
+ * recipientEncryptedKeys RecipientEncryptedKeys
+ * }
+ *
+ * UserKeyingMaterial ::= OCTET STRING
+ * </pre>
+ */
public class KeyAgreeRecipientInfo
extends ASN1Object
{
@@ -32,7 +48,10 @@ public class KeyAgreeRecipientInfo
this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
this.recipientEncryptedKeys = recipientEncryptedKeys;
}
-
+
+ /**
+ * @deprecated use getInstance()
+ */
public KeyAgreeRecipientInfo(
ASN1Sequence seq)
{
@@ -55,7 +74,7 @@ public class KeyAgreeRecipientInfo
}
/**
- * return a KeyAgreeRecipientInfo object from a tagged object.
+ * Return a KeyAgreeRecipientInfo object from a tagged object.
*
* @param obj the tagged object holding the object we want.
* @param explicit true if the object is meant to be explicitly
@@ -71,7 +90,14 @@ public class KeyAgreeRecipientInfo
}
/**
- * return a KeyAgreeRecipientInfo object from the given object.
+ * Return a KeyAgreeRecipientInfo object from the given object.
+ * <p>
+ * Accepted inputs:
+ * <ul>
+ * <li> null &rarr; null
+ * <li> {@link KeyAgreeRecipientInfo} object
+ * <li> {@link org.bouncycastle.asn1.ASN1Sequence#getInstance(java.lang.Object) ASN1Sequence} input formats with KeyAgreeRecipientInfo structure inside
+ * </ul>
*
* @param obj the object we want converted.
* @exception IllegalArgumentException if the object cannot be converted.
@@ -79,19 +105,17 @@ public class KeyAgreeRecipientInfo
public static KeyAgreeRecipientInfo getInstance(
Object obj)
{
- if (obj == null || obj instanceof KeyAgreeRecipientInfo)
+ if (obj instanceof KeyAgreeRecipientInfo)
{
return (KeyAgreeRecipientInfo)obj;
}
- if (obj instanceof ASN1Sequence)
+ if (obj != null)
{
- return new KeyAgreeRecipientInfo((ASN1Sequence)obj);
+ return new KeyAgreeRecipientInfo(ASN1Sequence.getInstance(obj));
}
- throw new IllegalArgumentException(
- "Illegal object in KeyAgreeRecipientInfo: " + obj.getClass().getName());
-
+ return null;
}
public ASN1Integer getVersion()
@@ -121,17 +145,6 @@ public class KeyAgreeRecipientInfo
/**
* Produce an object suitable for an ASN1OutputStream.
- * <pre>
- * KeyAgreeRecipientInfo ::= SEQUENCE {
- * version CMSVersion, -- always set to 3
- * originator [0] EXPLICIT OriginatorIdentifierOrKey,
- * ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
- * keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
- * recipientEncryptedKeys RecipientEncryptedKeys
- * }
- *
- * UserKeyingMaterial ::= OCTET STRING
- * </pre>
*/
public ASN1Primitive toASN1Primitive()
{