ASN1SafeBag.fromSequence constructor
ASN1SafeBag.fromSequence(
- ASN1Sequence seq
Creates a SafeBag object from the given sequence consisting of up to three elements :
- ASN1ObjectIdentifier
EncryptedPrivateKeyInfo
orCertBag
- ASN1Set (OPTIONAL)
Implementation
ASN1SafeBag.fromSequence(ASN1Sequence seq) {
bagId = seq.elements!.elementAt(0) as ASN1ObjectIdentifier;
if (seq.elements!.length >= 2) {
var el = seq.elements!.elementAt(1);
if (el.tag == 0xA0) {
bagValue = ASN1Parser(el.valueBytes).nextObject();
} else {
bagValue = el;
}
}
if (seq.elements!.length == 3) {
bagAttributes = seq.elements!.elementAt(2) as ASN1Set;
}
}