/** * return an AuthenticatedData object from the given object. * * @param obj the object we want converted. * @throws IllegalArgumentException if the object cannot be converted. */ public static AuthenticatedData getInstance( Object obj) { if (obj == null || obj instanceof AuthenticatedData) { return (AuthenticatedData)obj; } if (obj instanceof ASN1Sequence) { return new AuthenticatedData((ASN1Sequence)obj); } throw new IllegalArgumentException("Invalid AuthenticatedData: " + obj.getClass().getName()); }
/** * Return an AuthenticatedData object from the given object. * <p> * Accepted inputs: * <ul> * <li> null → null * <li> {@link AuthenticatedData} object * <li> {@link org.spongycastle.asn1.ASN1Sequence#getInstance(java.lang.Object) ASN1Sequence} input formats with AuthenticatedData structure inside * </ul> * * @param obj the object we want converted. * @return a reference that can be assigned to AuthenticatedData (may be null) * @throws IllegalArgumentException if the object cannot be converted. */ public static AuthenticatedData getInstance( Object obj) { if (obj instanceof AuthenticatedData) { return (AuthenticatedData)obj; } else if (obj != null) { return new AuthenticatedData(ASN1Sequence.getInstance(obj)); } return null; }
encContent); authData = new AuthenticatedData(originatorInfo, new DERSet(recipientInfos), macCalculator.getAlgorithmIdentifier(), digestCalculator.getAlgorithmIdentifier(), eci, authed, macResult, unauthed); encContent); authData = new AuthenticatedData(originatorInfo, new DERSet(recipientInfos), macCalculator.getAlgorithmIdentifier(), null, eci, null, macResult, unauthed);
encContent); authData = new AuthenticatedData(originatorInfo, new DERSet(recipientInfos), macCalculator.getAlgorithmIdentifier(), digestCalculator.getAlgorithmIdentifier(), eci, authed, macResult, unauthed); encContent); authData = new AuthenticatedData(originatorInfo, new DERSet(recipientInfos), macCalculator.getAlgorithmIdentifier(), null, eci, null, macResult, unauthed);