private string DecryptToken(string encryptedConnectToken, AsymmetricCipherKeyPair keyPair) { // token was encoded as a urlsafe base64 so it can be transfered in a url byte[] cipherBytes = Conversion.UrlSafeBase64ToBytes(encryptedConnectToken); byte[] decipheredBytes = CryptoEngine.DecryptRsa(cipherBytes, keyPair); return(Conversion.BytesToUtf8(decipheredBytes)); }
private byte[] UnwrapKey(string wrappedKey, AsymmetricCipherKeyPair keyPair) { byte[] cipherBytes = Conversion.Base64ToBytes(wrappedKey); return(CryptoEngine.DecryptRsa(cipherBytes, keyPair)); }