CertificateExtension.EnhancedKeyUsage method has been added in Rebex Security 2014 R3, which means the code below is no longer needed.
This looks like an omission on our part. We wanted to add a CertificateExtension.EnhancedKeyUsage method (similar to CertificateExtension.KeyUsage), but never actually implemented it, even though we support extended/enhanced key usage extension in other parts of our library.
Fortunately, a workaround for this is not too complicated:
// construct a sequence of a single extended key usage item
// (see http://www.alvestrand.no/objectid/220.127.116.11.html for details)
var oid = new ObjectIdentifier("18.104.22.168.22.214.171.124.2"); //Client Authentication
byte rawOid = oid.ToArray(true);
byte rawOidList = new byte[rawOid.Length + 2];
rawOidList = 0x30; // sequence
rawOidList = (byte)rawOid.Length; // length (OID length should fit into one byte)
// add a non-critical "extended key usage" extension with the raw OID list
csr.CertificateExtensions.Add(new CertificateExtension("126.96.36.199", false, rawOidList));
If you would like to try a beta of our library when we add CertificateExtension.EnhancedKeyUsage method, please let me know. Thanks for bringing this to our attention!