示例#1
0
        // Token: 0x06000010 RID: 16 RVA: 0x000025C0 File Offset: 0x000007C0
        internal static byte[] GetDERFromPEM(string sPEM)
        {
            uint num = 0U;
            uint num2;
            uint num3;

            if (!RSACryptoServiceProviderExtension.CryptStringToBinary(sPEM, (uint)sPEM.Length, RSACryptoServiceProviderExtension.CRYPT_STRING_FLAGS.CRYPT_STRING_BASE64HEADER, null, ref num, out num2, out num3))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }
            byte[] array = new byte[num];
            if (!RSACryptoServiceProviderExtension.CryptStringToBinary(sPEM, (uint)sPEM.Length, RSACryptoServiceProviderExtension.CRYPT_STRING_FLAGS.CRYPT_STRING_BASE64HEADER, array, ref num, out num2, out num3))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }
            return(array);
        }
示例#2
0
        // Token: 0x06000008 RID: 8 RVA: 0x00002330 File Offset: 0x00000530
        private bool RSACheckContent(byte[] signContent, byte[] sign, string publicKeyPem, string signType)
        {
            bool result;

            try
            {
                RSACryptoServiceProvider rsacryptoServiceProvider = new RSACryptoServiceProvider();
                rsacryptoServiceProvider.PersistKeyInCsp = false;
                RSACryptoServiceProviderExtension.LoadPublicKeyPEM(rsacryptoServiceProvider, publicKeyPem);
                bool flag = rsacryptoServiceProvider.VerifyData(signContent, signType, sign);
                result = flag;
            }
            catch
            {
                result = false;
            }
            return(result);
        }
示例#3
0
 // Token: 0x0600000D RID: 13 RVA: 0x0000242C File Offset: 0x0000062C
 internal static void LoadPublicKeyPEM(RSACryptoServiceProvider provider, string sPEM)
 {
     byte[] derfromPEM = RSACryptoServiceProviderExtension.GetDERFromPEM(sPEM);
     RSACryptoServiceProviderExtension.LoadPublicKeyDER(provider, derfromPEM);
 }
示例#4
0
 // Token: 0x0600000C RID: 12 RVA: 0x00002408 File Offset: 0x00000608
 private static void LoadPublicKeyDER(RSACryptoServiceProvider provider, byte[] DERData)
 {
     byte[] rsafromDER           = RSACryptoServiceProviderExtension.GetRSAFromDER(DERData);
     byte[] publicKeyBlobFromRSA = RSACryptoServiceProviderExtension.GetPublicKeyBlobFromRSA(rsafromDER);
     provider.ImportCspBlob(publicKeyBlobFromRSA);
 }