private KEKRecipientInfo getKEKInfo(ASN1TaggedObject o) { if (o.isExplicit()) { // compatibilty with erroneous version return KEKRecipientInfo.getInstance(o, true); } else { return KEKRecipientInfo.getInstance(o, false); } }
/** * Return a KEKRecipientInfo object from the given object. * <p> * Accepted inputs: * <ul> * <li> null → null * <li> {@link KEKRecipientInfo} object * <li> {@link org.bouncycastle.asn1.ASN1Sequence#getInstance(java.lang.Object) ASN1Sequence} input formats with KEKRecipientInfo structure inside * </ul> * * @param obj the object we want converted. * @exception IllegalArgumentException if the object cannot be converted. */ public static KEKRecipientInfo getInstance( Object obj) { if (obj instanceof KEKRecipientInfo) { return (KEKRecipientInfo)obj; } if (obj != null) { return new KEKRecipientInfo(ASN1Sequence.getInstance(obj)); } return null; }
public ASN1Integer getVersion() { if (info instanceof ASN1TaggedObject) { ASN1TaggedObject o = (ASN1TaggedObject)info; switch (o.getTagNo()) { case 1: return KeyAgreeRecipientInfo.getInstance(o, false).getVersion(); case 2: return getKEKInfo(o).getVersion(); case 3: return PasswordRecipientInfo.getInstance(o, false).getVersion(); case 4: return new ASN1Integer(0); // no syntax version for OtherRecipientInfo default: throw new IllegalStateException("unknown tag"); } } return KeyTransRecipientInfo.getInstance(info).getVersion(); }
/** * Return a KEKRecipientInfo object from the given object. * <p> * Accepted inputs: * <ul> * <li> null → null * <li> {@link KEKRecipientInfo} object * <li> {@link org.bouncycastle.asn1.ASN1Sequence#getInstance(java.lang.Object) ASN1Sequence} input formats with KEKRecipientInfo structure inside * </ul> * * @param obj the object we want converted. * @exception IllegalArgumentException if the object cannot be converted. */ public static KEKRecipientInfo getInstance( Object obj) { if (obj instanceof KEKRecipientInfo) { return (KEKRecipientInfo)obj; } if (obj != null) { return new KEKRecipientInfo(ASN1Sequence.getInstance(obj)); } return null; }
public ASN1Integer getVersion() { if (info instanceof ASN1TaggedObject) { ASN1TaggedObject o = (ASN1TaggedObject)info; switch (o.getTagNo()) { case 1: return KeyAgreeRecipientInfo.getInstance(o, false).getVersion(); case 2: return getKEKInfo(o).getVersion(); case 3: return PasswordRecipientInfo.getInstance(o, false).getVersion(); case 4: return new ASN1Integer(0); // no syntax version for OtherRecipientInfo default: throw new IllegalStateException("unknown tag"); } } return KeyTransRecipientInfo.getInstance(info).getVersion(); }
private KEKRecipientInfo getKEKInfo(ASN1TaggedObject o) { if (o.isExplicit()) { // compatibilty with erroneous version return KEKRecipientInfo.getInstance(o, true); } else { return KEKRecipientInfo.getInstance(o, false); } }
/** * Return a KEKRecipientInfo 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 * tagged false otherwise. * @exception IllegalArgumentException if the object held by the * tagged object cannot be converted. */ public static KEKRecipientInfo getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
/** * Return a KEKRecipientInfo 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 * tagged false otherwise. * @exception IllegalArgumentException if the object held by the * tagged object cannot be converted. */ public static KEKRecipientInfo getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }