diff dstep/security/SecCertificate.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children 19885b43130e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/security/SecCertificate.d	Sat Aug 01 15:03:28 2009 +0200
@@ -0,0 +1,60 @@
+/**
+ * Copyright: Copyright (c) 2009 Jacob Carlborg.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: Jul 22, 2009 
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
+ */
+module dstep.security.SecCertificate;
+
+//import dstep.AvailabilityMacros;
+import dstep.corefoundation.CFArray;
+import dstep.corefoundation.CFBase;
+import dstep.corefoundation.CFDate;
+import dstep.objc.bridge.TypeEncoding;
+import dstep.security.SecBase;
+import dstep.security.cssmtype;
+import dstep.security.x509defs;
+
+// This is needed otherwise the enums will fail compiling with gdc
+version (GNU)
+{
+	private
+	{
+		const __kSecSubjectItemAttr = getOSType!("subj");
+		const __kSecIssuerItemAttr = getOSType!("issu");
+		const __kSecSerialNumberItemAttr = getOSType!("snbr");
+		const __kSecPublicKeyHashItemAttr = getOSType!("hpky");
+		const __kSecSubjectKeyIdentifierItemAttr = getOSType!("skid");
+		const __kSecCertTypeItemAttr = getOSType!("ctyp");
+		const __kSecCertEncodingItemAttr = getOSType!("cenc");
+	}
+}
+
+enum
+{
+	kSecSubjectItemAttr = getOSType!("subj"),
+	kSecIssuerItemAttr = getOSType!("issu"),
+	kSecSerialNumberItemAttr = getOSType!("snbr"),
+	kSecPublicKeyHashItemAttr = getOSType!("hpky"),
+	kSecSubjectKeyIdentifierItemAttr = getOSType!("skid"),
+	kSecCertTypeItemAttr = getOSType!("ctyp"),
+	kSecCertEncodingItemAttr = getOSType!("cenc")
+}
+
+extern (C)
+{
+	uint SecCertificateGetTypeID ();
+	int SecCertificateCreateFromData (CSSM_DATA* data, uint type, uint encoding, SecCertificateRef* certificate);
+	int SecCertificateAddToKeychain (SecCertificateRef certificate, SecKeychainRef keychain);
+	int SecCertificateGetData (SecCertificateRef certificate, CSSM_DATA_PTR data);
+	int SecCertificateGetType (SecCertificateRef certificate, CSSM_CERT_TYPE* certificateType);
+	int SecCertificateGetSubject (SecCertificateRef certificate, CSSM_X509_NAME** subject);
+	int SecCertificateGetIssuer (SecCertificateRef certificate, CSSM_X509_NAME** issuer);
+	int SecCertificateGetCLHandle (SecCertificateRef certificate, CSSM_CL_HANDLE* clHandle);
+	int SecCertificateGetAlgorithmID (SecCertificateRef certificate, CSSM_X509_ALGORITHM_IDENTIFIER** algid);
+	int SecCertificateCopyPublicKey (SecCertificateRef certificate, SecKeyRef* key);
+	int SecCertificateCopyCommonName (SecCertificateRef certificate, CFStringRef* commonName);
+	int SecCertificateCopyEmailAddresses (SecCertificateRef certificate, CFArrayRef* emailAddresses);
+	int SecCertificateCopyPreference (CFStringRef name, uint keyUsage, SecCertificateRef* certificate);
+	int SecCertificateSetPreference (SecCertificateRef certificate, CFStringRef name, uint keyUsage, CFDateRef date);
+}
\ No newline at end of file