1 /**
2 An X509 certificate (e.g. for SSL).
3 
4 Copyright:
5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
7 Copyright (c) 2017-2018 Godot-D contributors  
8 
9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
10 
11 
12 */
13 module godot.x509certificate;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.traits;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.globalenums;
22 import godot.object;
23 import godot.classdb;
24 import godot.resource;
25 import godot.reference;
26 /**
27 An X509 certificate (e.g. for SSL).
28 
29 The X509Certificate class represents an X509 certificate. Certificates can be loaded and saved like any other $(D Resource).
30 They can be used as the server certificate in $(D StreamPeerSSL.acceptStream) (along with the proper $(D CryptoKey)), and to specify the only certificate that should be accepted when connecting to an SSL server via $(D StreamPeerSSL.connectToStream).
31 $(B Note:) Not available in HTML5 exports.
32 */
33 @GodotBaseClass struct X509Certificate
34 {
35 	package(godot) enum string _GODOT_internal_name = "X509Certificate";
36 public:
37 @nogc nothrow:
38 	union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; }
39 	alias _GODOT_base this;
40 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
41 	package(godot) __gshared bool _classBindingInitialized = false;
42 	package(godot) static struct GDNativeClassBinding
43 	{
44 		__gshared:
45 		@GodotName("load") GodotMethod!(GodotError, String) load;
46 		@GodotName("save") GodotMethod!(GodotError, String) save;
47 	}
48 	/// 
49 	pragma(inline, true) bool opEquals(in X509Certificate other) const
50 	{ return _godot_object.ptr is other._godot_object.ptr; }
51 	/// 
52 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
53 	{ _godot_object.ptr = n; return null; }
54 	/// 
55 	pragma(inline, true) bool opEquals(typeof(null) n) const
56 	{ return _godot_object.ptr is n; }
57 	/// 
58 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
59 	mixin baseCasts;
60 	/// Construct a new instance of X509Certificate.
61 	/// Note: use `memnew!X509Certificate` instead.
62 	static X509Certificate _new()
63 	{
64 		static godot_class_constructor constructor;
65 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("X509Certificate");
66 		if(constructor is null) return typeof(this).init;
67 		return cast(X509Certificate)(constructor());
68 	}
69 	@disable new(size_t s);
70 	/**
71 	Loads a certificate from `path` ("*.crt" file).
72 	*/
73 	GodotError load(in String path)
74 	{
75 		checkClassBinding!(typeof(this))();
76 		return ptrcall!(GodotError)(GDNativeClassBinding.load, _godot_object, path);
77 	}
78 	/**
79 	Saves a certificate to the given `path` (should be a "*.crt" file).
80 	*/
81 	GodotError save(in String path)
82 	{
83 		checkClassBinding!(typeof(this))();
84 		return ptrcall!(GodotError)(GDNativeClassBinding.save, _godot_object, path);
85 	}
86 }