protected virtual async Task <PublicKeyX509Certificate> GetPublicKeyAsync(CancellationToken cancelToken = default(CancellationToken)) { try { var sessionConfigBuilder = new SessionConfigUrlBuilder(this.restGrammar, this.webApiGrammar); var taskFlow = new GetPublicKeyTasks(sessionConfigBuilder, this.restGrammar, this.webApiGrammar, this.httpClient); PublicKeyX509Certificate result = await RestApiCallFlow.LoadRequestFromNetworkFlow(this.sessionConfig, taskFlow, cancelToken); this.publicCertifiacte = result; } catch (ObjectDisposedException) { // CancellationToken.ThrowIfCancellationRequested() throw; } catch (OperationCanceledException) { // CancellationToken.ThrowIfCancellationRequested() // and TaskCanceledException throw; } catch (SitecoreMobileSdkException ex) { // throw unwrapped exception as if GetPublicKeyAsync() is an atomic phase throw new RsaHandshakeException("[Sitecore Mobile SDK] Public key not received properly", ex.InnerException); } catch (Exception ex) { throw new RsaHandshakeException("[Sitecore Mobile SDK] Public key not received properly", ex); } return(this.publicCertifiacte); }
public void Setup() { string modulus = "v4oNDJlxRJB7svUE3U3dTuJeqr/qtwyccCAQZkbKICOVs8ECuh/CTKks3YyGPbcUdriMqmwjbIP5KSxI22/2QfvaDRSUoXQLzq+pr4MNKyL9ZPI3g2fcByCQPa45LMUfBgbqA6uggET/Tj6SI87l0mgPL6wZwoAFHOrVfGHLSRcuKHZTrfXSoiB7l24RgeArXTGuDbQ3b5eLPXowv5kCsdDvzg//nlED4kQ/HphrSd5XCYBXXTbZrTtwxRWpi/Y0MucX1xn34TLb6VFhZ2AKqlsYKG2Wxjlt/4bxMKAPsz31q4Cv1xulkP6jX9sivkNUKFDncyMmxuXx4/rIlL7zxw=="; string exponent = "AQAB"; this.publicCertificate = new PublicKeyX509Certificate(modulus, exponent); modulus = "v4oNDJlxRJB7svUE3U3dTuJeqr/qtwyccCAQZkbKICOVs8ECuh/CTKks3YyGPbcUdriMqmwjbIP5KSxI22/2QfvaDRSUoXQLzq+pr4MNKyL9ZPI3g2fcByCQPa45LMUfBgbqA6uggET/Tj6SI87l0mgPL6wZwoAFHOrVfGHLSRcuKHZTrfXSoiB7l24RgeArXTGuDbQ3b5eLPXowv5kCsdDvzg//nlED4kQ/HphrSd5XCYBXXTbZrTtwxRWpi/Y0MucX1xn34TLb6VFhZ2AKqlsYKG2Wxjlt/4bxMKAPsz31q4Cv1xulkP6jX9sivkNUKFDncyMmxuXx4/rIlL7zxw=="; exponent = "AQAB"; this.privateCertificate = new PublicKeyX509Certificate(modulus, exponent); }
public void TearDown() { this.publicCertificate = null; this.privateCertificate = null; }