Skip to content

Commit

Permalink
feat: ProxyCertInfo extension
Browse files Browse the repository at this point in the history
  • Loading branch information
rbellens committed Nov 4, 2022
1 parent db387ef commit 17df803
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions lib/src/extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ abstract class ExtensionValue {
return AuthorityInformationAccess.fromAsn1(obj as ASN1Sequence);
case 3:
return QCStatements.fromAsn1(obj as ASN1Sequence);
case 14:
return ProxyCertInfo.fromAsn1(obj as ASN1Sequence);
}
}
throw UnimplementedError(
Expand Down Expand Up @@ -892,3 +894,41 @@ class GeneralSubtree {
maximum: obj.elements.length > 2 ? toDart(obj.elements[2]) : null);
}
}

class ProxyCertInfo extends ExtensionValue {
final BigInt? pCPathLenConstraint;

final ProxyPolicy proxyPolicy;

// ProxyCertInfoExtension ::= SEQUENCE {
// pCPathLenConstraint ProxyCertPathLengthConstraint OPTIONAL,
// proxyPolicy ProxyPolicy
// }
factory ProxyCertInfo.fromAsn1(ASN1Sequence obj) {
return ProxyCertInfo(
pCPathLenConstraint:
obj.elements.length > 1 ? toDart(obj.elements[0]) : null,
proxyPolicy: ProxyPolicy.fromAsn1(obj.elements.last as ASN1Sequence));
}

ProxyCertInfo({this.pCPathLenConstraint, required this.proxyPolicy});
}

class ProxyPolicy {
final ObjectIdentifier policyLanguage;

final String? policy;

// ProxyPolicy ::= SEQUENCE {
// policyLanguage OBJECT IDENTIFIER,
// policy OCTET STRING OPTIONAL
// }
factory ProxyPolicy.fromAsn1(ASN1Sequence obj) {
return ProxyPolicy(
policyLanguage:
ObjectIdentifier.fromAsn1(obj.elements[0] as ASN1ObjectIdentifier),
policy: obj.elements.length > 1 ? toDart(obj.elements[1]) : null);
}

ProxyPolicy({required this.policyLanguage, this.policy});
}

0 comments on commit 17df803

Please sign in to comment.