본문 바로가기

C#29

23# RSACryptoServiceProvider public static string RSAEncrypt(string getValue, string pubKey) { RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(); rsa.FromXmlString(pubKey); //암호화할 문자열을 UFT8인코딩 byte[] inbuf = (new UTF8Encoding()).GetBytes(getValue); //암호화 byte[] encbuf = rsa.Encrypt(inbuf, false); //암호화된 문자열 Base64인코딩 return System.Convert.ToBase64String(encbuf); } Visual 2017 4.5 버전으로 확인할 때와 다르게 Visual 2019 4.72.. 2019. 10. 1.
22# CQRS 채용공고에서 CQRS라는 개념을 보고 호기심에 찾아봤다. 현재 쓰고 있는 방식과 어떤 부분이 다르나 확인했더니 기본적인 사용 아키텍쳐가 살짝 다르다. 서버를 하면서 오류가 나면 명확하게 알 수 있는 장점이 있었다. 하지만 입력를 완료하고 바로 유저 정보를 조회를 하면 커넥션에 대한 리소스는 줄어들 것이다. 이해한 정보로 예제 코드를 작성해봤다. CQRS Style // Command and Query Responsibility Segregation private static void CQRSStyle() { //회원가입 Int64 userKey = CQRSInsert(); //결과물을 받아야 하지만 생략. CQRSSelect(userKey); } private static Int64 CQRSInsert(.. 2019. 8. 9.
21# C# Mysql Connection 라이브러리 using System; using System.Collections.Generic; using System.Data; using System.Reflection; using MySql.Data.MySqlClient; using System.Runtime.CompilerServices; namespace Project.MySql { /// /// MySqlManager의 요약 설명입니다. /// public static class MySqlManager { public static Int32 ExecuteScalar(string connectionString, string procedureName, Dictionary paramsList) { Int32 resultCode = (Int32)ErrorNum.. 2019. 5. 23.
20# C#에서 구글 API OAuth로 정보 가져오기 1. 프로젝트 등록 https://console.cloud.google.com/projectselector2/apis/credentials?supportedpurview=project Google Cloud Platform 하나의 계정으로 모든 Google 서비스를 Google Cloud Platform을 사용하려면 로그인하세요. accounts.google.com 2. 구글 정보 요청 여기서 Scope란 구글에 어떤 항목에 정보를 요청할지 목록을 정하는 행동이다. CLIENT_ID는 OAuth에서 가져온 Client ID, redirect에는 http://localhost를 적는다. 그리고 해당 url을 복사해서 인터넷 창에 넣으면 구글 로그인 요청 창이 뜬다. 권한을 확인하면 해당 url이 code=.. 2019. 5. 8.