Skip to content

Commit

Permalink
Support X.509 authentication type in external provisioning. (#1662)
Browse files Browse the repository at this point in the history
* Support X.509 authentication type in external provisioning.

* Add tests

* Incorporating review comments.

* Test fix

* Fix tests #2

* Fix mut reference

* Fix error reasons

* Put enum variants in alphabetical order.
  • Loading branch information
shantanu1singh authored Sep 7, 2019
1 parent 2b47aec commit 0a43fdb
Show file tree
Hide file tree
Showing 6 changed files with 764 additions and 153 deletions.
2 changes: 1 addition & 1 deletion edgelet/edgelet-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub use module::{
};
pub use network::{Ipam, IpamConfig, MobyNetwork, Network};
pub use settings::{
AttestationMethod, Certificates, Connect, Dps, Listen, Manual, ManualAuthMethod,
AttestationMethod, Certificates, Connect, Dps, External, Listen, Manual, ManualAuthMethod,
ManualDeviceConnectionString, ManualX509Auth, Provisioning, RetryLimit, RuntimeSettings,
Settings, SymmetricKeyAttestationInfo, TpmAttestationInfo, WatchdogSettings,
X509AttestationInfo,
Expand Down
22 changes: 22 additions & 0 deletions edgelet/iotedged/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,12 @@ pub enum InitializeErrorReason {
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ExternalProvisioningErrorReason {
ClientInitialization,
DownloadIdentityCertificate,
DownloadIdentityPrivateKey,
ExternalProvisioningDirCreate,
HsmInitialization,
HsmKeyRetrieval,
HybridKeyPreparation,
InvalidAuthenticationType,
InvalidCredentials,
Provisioning,
Expand Down Expand Up @@ -364,6 +368,20 @@ impl fmt::Display for ExternalProvisioningErrorReason {
write!(f, "Could not create the external provisioning client.")
}

ExternalProvisioningErrorReason::DownloadIdentityCertificate => write!(
f,
"The download of the identity certificate from the external environment failed."
),

ExternalProvisioningErrorReason::DownloadIdentityPrivateKey => write!(
f,
"The download of the identity private key from the external environment failed."
),

ExternalProvisioningErrorReason::ExternalProvisioningDirCreate => {
write!(f, "Could not create the external provisioning directory.")
}

ExternalProvisioningErrorReason::HsmInitialization => {
write!(f, "Could not initialize the HSM interface.")
}
Expand All @@ -372,6 +390,10 @@ impl fmt::Display for ExternalProvisioningErrorReason {
write!(f, "Could not retrieve the device's key from the HSM.")
}

ExternalProvisioningErrorReason::HybridKeyPreparation => {
write!(f, "Could not prepare the hybrid key.")
}

ExternalProvisioningErrorReason::InvalidAuthenticationType => {
write!(f, "Invalid authentication type specified.")
}
Expand Down
Loading

0 comments on commit 0a43fdb

Please sign in to comment.