use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.
the class CMSAuthenticatedDataParser method getUnauthAttrs.
/**
* return a table of the unauthenticated attributes indexed by the OID of the attribute.
*
* @throws IOException
*/
public AttributeTable getUnauthAttrs() throws IOException {
if (unauthAttrs == null && unauthAttrNotRead) {
ASN1SetParser set = authData.getUnauthAttrs();
unauthAttrNotRead = false;
if (set != null) {
ASN1EncodableVector v = new ASN1EncodableVector();
ASN1Encodable o;
while ((o = set.readObject()) != null) {
ASN1SequenceParser seq = (ASN1SequenceParser) o;
v.add(seq.toASN1Primitive());
}
unauthAttrs = new AttributeTable(new DERSet(v));
}
}
return unauthAttrs;
}
use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.
the class AuthenticatedDataParser method getUnauthAttrs.
public ASN1SetParser getUnauthAttrs() throws IOException {
if (nextObject == null) {
nextObject = seq.readObject();
}
if (nextObject != null) {
ASN1TaggedObject o = (ASN1TaggedObject) nextObject;
nextObject = null;
return (ASN1SetParser) ASN1Util.parseContextBaseUniversal(o, 3, false, BERTags.SET_OF);
}
return null;
}
use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.
the class AuthenticatedDataParser method getRecipientInfos.
public ASN1SetParser getRecipientInfos() throws IOException {
if (!originatorInfoCalled) {
getOriginatorInfo();
}
if (nextObject == null) {
nextObject = seq.readObject();
}
ASN1SetParser recipientInfos = (ASN1SetParser) nextObject;
nextObject = null;
return recipientInfos;
}
use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.
the class CMSAuthenticatedDataParser method getAuthAttrSet.
private ASN1Set getAuthAttrSet() throws IOException {
if (authAttrs == null && authAttrNotRead) {
ASN1SetParser set = authData.getAuthAttrs();
if (set != null) {
authAttrSet = (ASN1Set) set.toASN1Primitive();
}
authAttrNotRead = false;
}
return authAttrSet;
}
use of com.github.zhenwei.core.asn1.ASN1SetParser in project LinLong-Java by zhenwei1108.
the class CMSSignedDataParser method getSignerInfos.
/**
* return the collection of signers that are associated with the signatures for the message.
*
* @throws CMSException
*/
public SignerInformationStore getSignerInfos() throws CMSException {
if (_signerInfoStore == null) {
populateCertCrlSets();
List signerInfos = new ArrayList();
Map hashes = new HashMap();
Iterator it = digests.keySet().iterator();
while (it.hasNext()) {
Object digestKey = it.next();
hashes.put(digestKey, ((DigestCalculator) digests.get(digestKey)).getDigest());
}
try {
ASN1SetParser s = _signedData.getSignerInfos();
ASN1Encodable o;
while ((o = s.readObject()) != null) {
SignerInfo info = SignerInfo.getInstance(o.toASN1Primitive());
byte[] hash = (byte[]) hashes.get(info.getDigestAlgorithm().getAlgorithm());
signerInfos.add(new SignerInformation(info, _signedContentType, null, hash));
}
} catch (IOException e) {
throw new CMSException("io exception: " + e.getMessage(), e);
}
_signerInfoStore = new SignerInformationStore(signerInfos);
}
return _signerInfoStore;
}
Aggregations