cryptography

SHA256withRSA what does it do and in what order?

ε祈祈猫儿з 提交于 2020-04-28 04:13:20
问题 I'm a total newbie when it comes to cryptography and such things. I don't (and dont want to) know the details of the SHA256 and RSA. I "know" what they do, not how they do it, and for now that's enough. I'm wondering what the "SHA256withRSA"-algorithm (if you can call it that) actually do and in what order. For example, does it hash the data with SHA256 and then encrypts it using RSA or is it vice-versa, or something else? The reason I'm asking is because I wanna do the java equivalent of:

.NET MVC5之网站安全

坚强是说给别人听的谎言 提交于 2020-04-24 14:32:54
XSS(脚本攻击) 使用AntiXSS Library的AntiXssEncoder 或 public static String SafeHtml ( this string helper , string str ) { var filterString = str == null ? "" : str . Trim (); if ( string . IsNullOrWhiteSpace ( filterString )) return null ; var regex = new Regex ( @" < (?! br | \/ ? p | style | \/ ? span ) [^ > ] * > " ); filterString = regex . Replace ( filterString , "" ); return filterString ; } CSRF或XSRF(跨网站伪造请求) 写入后端的数据都是用POST 限制POST的Action不接受GET 在服务器端判断数据的来源,Html.AntiForgeryToken() 加密与解密 增加密码的复杂度:长度至少8位,至少有一个大小写英文,至少包含一个数字 密码存储:哈希(hash)加密后存储 窗体验证原则 使用https 使用http post 对数据校验 不要使用隐藏字段 不要提示过多的错误信息

【C#】工具类-FTP操作封装类FTPHelper

时光怂恿深爱的人放手 提交于 2020-04-24 13:03:44
C# FTPHelper实现FTP服务器文件读写操作,支持SSL协议(FTP服务器为:Serv-U10.0)。 using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; using System.Text; namespace FTPTest { public class FTPHelper { #region 变量 /// <summary> /// FTP请求对象 /// </summary> FtpWebRequest request = null ; /// <summary> /// FTP响应对象 /// </summary> FtpWebResponse response = null ; /// <summary> /// FTP服务器长地址 /// </summary> public string FtpURI { get ; private set ; } /// <summary> /// FTP服务器IP /// </summary> public

在电脑如此普遍的今天,这是每个人都有必要了解的计算机知识

不问归期 提交于 2020-04-23 07:23:49
给你们推荐一个科普视频, 计算机科学速成课 - Crash Course Computer Science 它所讲内容几乎涵盖了所有计算机相关知识,而且小姐姐讲得很生动有趣。它从 计算机历史 到 计算机组成,编程、算法、数据结构 再到 互联网 、 黑客&攻击 、 机器学习&人工智能 ,最后是 计算机未来。 不管你是否从业于IT行业,我觉得都很有必要了解计算机科学。了解它的历史,原理和互联网相关知识,这本身就是很有趣的东西。 它的主要内容如下: 1. 计算机早期历史-Early Computing 2. 电子计算机-Electronic Computing 3. 布尔逻辑 和 逻辑门-Boolean Logic & Logic Gates 4. 二进制-Representing Numbers and Letters with Binary_BiliBili 5. 算术逻辑单元-How Computers Calculate-the ALU 6. 寄存器 & 内存-Registers and RAM_BiliBili 7. 中央处理器(CPU)-The Central Processing Unit 8. 指令和程序-Instructions & Programs 9. 高级CPU设计-Advanced CPU Designs_BiliBili 10. 早期的编程方式-Early

How to export EC private key as PKCS#1 or PKCS#8 format from certificate store by CNG?

二次信任 提交于 2020-04-18 05:47:56
问题 I tried to export private key from certificate store by CNG API. It work fine when export RSA private key, but failed in EC private key. The code failed in NCryptExportKey() with 0x80090029 . Is there any document from MS said: Export EC private key not support? or any sample code? Here is my code: NCRYPT_KEY_HANDLE hKey = NULL; SECURITY_STATUS secStatus = ERROR_SUCCESS; NTSTATUS status = STATUS_UNSUCCESSFUL; DWORD dwKeySpec, cbData = 0, cbBlob = 0, KeyPolicy = 0; PBYTE pbHash = NULL, pbBlob

Unable to create .pem file from .p12 (private key + public key)

◇◆丶佛笑我妖孽 提交于 2020-04-18 05:44:45
问题 I am trying to create .pem file from .p12 file with below command, openssl x509 -inform der -in Certificates.p12 -out Certificates.pem But getting below error: 4412094060:error:0DFFF0A8:asn1 encoding routines:CRYPTO_internal:wrong tag:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.260.1/libressl-2.6/crypto/asn1/tasn_dec.c:1125: 4412094060:error:0DFFF03A:asn1 encoding routines:CRYPTO_internal:nested asn1 error:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl

Unable to create .pem file from .p12 (private key + public key)

夙愿已清 提交于 2020-04-18 05:42:17
问题 I am trying to create .pem file from .p12 file with below command, openssl x509 -inform der -in Certificates.p12 -out Certificates.pem But getting below error: 4412094060:error:0DFFF0A8:asn1 encoding routines:CRYPTO_internal:wrong tag:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.260.1/libressl-2.6/crypto/asn1/tasn_dec.c:1125: 4412094060:error:0DFFF03A:asn1 encoding routines:CRYPTO_internal:nested asn1 error:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl

Trouble loading RSA public key from file #2

我的未来我决定 提交于 2020-04-18 05:35:30
问题 Following Topaco's answer from previous post : Trouble loading RSA public key from file I've been reproducing the same using python : # Modulus, Exponent n = 0xC4F75716EC835D2325689F91FF85ED9BFC3211DB9C164F41852E264E569D2802008054A0EF459E7E3EABB87FAE576E735434D1D124B30B11BD6DE09814860155 e = 0x11 # Data to encrypt (m > n instead of m < n) buf = "c8cd2174b98433b93094b36026de125a7f5ed85ec27ee6bb9e996cb3b938e9c6238cc65d3615fb635f6f080f6dda06315928bcae4ccf802f9680547db57b8283" # convert buffer to

RunTime Error System.Security.Cryptography.CryptographicException: 'Bad Data. ' in vb.net when trying to import RSA parameters

↘锁芯ラ 提交于 2020-04-17 22:50:46
问题 Here's the code I am not sure if there's any hidden error but on runtime when trying to import the rsa parameters it pops up that error Function ModInverse(ByVal a As BigInteger, ByVal b As BigInteger) As BigInteger Dim b0 As BigInteger = b Dim t As BigInteger Dim q As BigInteger Dim x0 As BigInteger = 0 Dim x1 As BigInteger = 1 If b = 1 Then Return 1 While a > 1 q = BigInteger.Divide(a, b) t = b b = BigInteger.Remainder(a, b) a = t t = x0 x0 = BigInteger.Subtract(x1, BigInteger.Multiply(q,

RunTime Error System.Security.Cryptography.CryptographicException: 'Bad Data. ' in vb.net when trying to import RSA parameters

青春壹個敷衍的年華 提交于 2020-04-17 22:50:31
问题 Here's the code I am not sure if there's any hidden error but on runtime when trying to import the rsa parameters it pops up that error Function ModInverse(ByVal a As BigInteger, ByVal b As BigInteger) As BigInteger Dim b0 As BigInteger = b Dim t As BigInteger Dim q As BigInteger Dim x0 As BigInteger = 0 Dim x1 As BigInteger = 1 If b = 1 Then Return 1 While a > 1 q = BigInteger.Divide(a, b) t = b b = BigInteger.Remainder(a, b) a = t t = x0 x0 = BigInteger.Subtract(x1, BigInteger.Multiply(q,