Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
AcmeChallenge.cs
1
using
System;
2
using
System.Collections.Generic;
3
using
System.Threading.Tasks;
4
using
Waher.Content.Xml
;
5
6
namespace
Waher.Security.ACME
7
{
11
public
enum
AcmeChallengeStatus
12
{
16
pending,
17
21
processing,
22
26
valid,
27
31
invalid
32
}
33
37
public
class
AcmeChallenge
:
AcmeResource
38
{
39
private
readonly
AcmeChallengeStatus
status;
40
private
readonly
string
type;
41
private
readonly
string
token;
42
private
readonly DateTime? validated;
43
44
internal
AcmeChallenge
(
AcmeClient
Client
, Uri
AccountLocation
, IEnumerable<KeyValuePair<string, object>> Obj)
45
: base(
Client
,
AccountLocation
,
null
)
46
{
47
foreach
(KeyValuePair<string, object> P
in
Obj)
48
{
49
switch
(P.Key)
50
{
51
case
"status"
:
52
if
(!Enum.TryParse(P.Value as
string
, out
this
.status))
53
throw
new
ArgumentException(
"Invalid ACME challenge status: "
+ P.Value.ToString(),
"status"
);
54
break
;
55
56
case
"validated"
:
57
if
(
XML
.
TryParse
(P.Value as
string
, out DateTime TP))
58
this.validated = TP;
59
else
60
throw
new
ArgumentException(
"Invalid date and time value."
,
"validated"
);
61
break
;
62
63
case
"url"
:
64
this.Location =
new
Uri(P.Value as
string
);
65
break
;
66
67
case
"type"
:
68
this.type = P.Value as string;
69
break
;
70
71
case
"token"
:
72
this.token = P.Value as string;
73
break
;
74
}
75
}
76
}
77
81
public
AcmeChallengeStatus
Status
=> this.status;
82
86
public
DateTime?
Validated
=> this.validated;
87
91
public
string
Type
=> this.type;
92
96
public
string
Token
=> this.token;
97
101
public
virtual
string
KeyAuthorization
102
{
103
get
104
{
105
return
this.token +
"."
+ this.Client.JwkThumbprint;
106
}
107
}
108
113
public
Task<AcmeChallenge>
AcknowledgeChallenge
()
114
{
115
return
this.Client.
AcknowledgeChallenge
(this.AccountLocation, this.
Location
);
116
}
117
}
118
}
Waher.Content.Xml.XML
Helps with common XML-related tasks.
Definition:
XML.cs:19
Waher.Content.Xml.XML.TryParse
static bool TryParse(string s, out DateTime Value)
Tries to decode a string encoded DateTime.
Definition:
XML.cs:744
Waher.Security.ACME.AcmeChallenge
Base class of all ACME challenges.
Definition:
AcmeChallenge.cs:38
Waher.Security.ACME.AcmeChallenge.Validated
DateTime? Validated
When the challenge was validated.
Definition:
AcmeChallenge.cs:86
Waher.Security.ACME.AcmeChallenge.Status
AcmeChallengeStatus Status
The status of this challenge.
Definition:
AcmeChallenge.cs:81
Waher.Security.ACME.AcmeChallenge.AcknowledgeChallenge
Task< AcmeChallenge > AcknowledgeChallenge()
Acknowledges the challenge.
Definition:
AcmeChallenge.cs:113
Waher.Security.ACME.AcmeChallenge.KeyAuthorization
virtual string KeyAuthorization
Key authorization string. Used as response to challenge.
Definition:
AcmeChallenge.cs:102
Waher.Security.ACME.AcmeChallenge.Type
string Type
Type of challenge.
Definition:
AcmeChallenge.cs:91
Waher.Security.ACME.AcmeChallenge.Token
string Token
Token
Definition:
AcmeChallenge.cs:96
Waher.Security.ACME.AcmeClient
Implements an ACME client for the generation of certificates using ACME-compliant certificate servers...
Definition:
AcmeClient.cs:24
Waher.Security.ACME.AcmeClient.AcknowledgeChallenge
async Task< AcmeChallenge > AcknowledgeChallenge(Uri AccountLocation, Uri ChallengeLocation)
Acknowledges a challenge from the server.
Definition:
AcmeClient.cs:639
Waher.Security.ACME.AcmeObject.Client
AcmeClient Client
ACME client.
Definition:
AcmeObject.cs:26
Waher.Security.ACME.AcmeResource
Abstract base class for all ACME resources.
Definition:
AcmeResource.cs:11
Waher.Security.ACME.AcmeResource.Location
Uri Location
Location of resource.
Definition:
AcmeResource.cs:37
Waher.Security.ACME.AcmeResource.AccountLocation
Uri AccountLocation
Account location.
Definition:
AcmeResource.cs:31
Waher.Content.Xml
Definition:
XmlCodec.cs:11
Waher.Security.ACME
Definition:
AcmeAccount.cs:8
Waher.Security.ACME.AcmeChallengeStatus
AcmeChallengeStatus
ACME Challenge status enumeration
Definition:
AcmeChallenge.cs:12
IoTGateway
Security
Waher.Security.ACME
AcmeChallenge.cs
Generated by
1.9.5