Created
October 21, 2016 02:21
-
-
Save makah/acbf3782d8f2f94fd2da9d52458b8bba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IRegistryService Connect(String name, RSACryptoServiceProvider privateKey, X509Certificate2 acsCertificate) { | |
if ((String.IsNullOrEmpty(name)) || (acsCertificate == null) || | |
(privateKey == null)) | |
throw new ArgumentException("...."); | |
if (!String.IsNullOrEmpty(this.Credential.identifier)) | |
throw new ACSLoginFailureException("...."); | |
byte[] challenge = this.acs.getChallenge(name); | |
byte[] answer = new byte[0]; | |
try { | |
answer = Crypto.GenerateAnswer(challenge, privateKey, acsCertificate); | |
} | |
catch (CryptographicException e) { | |
throw new ACSLoginFailureException("....", e); | |
} | |
bool connect = this.acs.loginByCertificate(name, answer, out this.credential, out leaseTime); | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment