我正在按照本教程为我的软件实施许可解决方案。
在某些时候,教程要求运行 makecert 命令:
makecert -pe -ss My -sr CurrentUser -$ commercial -n "CN=<YourCertName>" -sky Signature
Run Code Online (Sandbox Code Playgroud)
但此时 makecert 已过时,我尝试使其工作的所有解决方案在带有 Visual Studio 2017 的 Windows 10 上都失败了。不,开发人员命令提示符没有帮助。不,安装 Windows SDK 没有帮助。
唯一严肃的解决方案似乎是接受过时的 makecert 并使用 Powershell New-SelfSignedCertificate 命令。
我可以创建这个表:
但我不确定这是否正确。您能帮我将此 MakeCert 命令翻译为 New-SelfSignedCertificate 命令吗?
它是否正确?
New-SelfSignedCertificate -KeyExportPolicy Exportable -CertStoreLocation "Cert:\CurrentUser\My" -Type Custom -Subject "CN=<YourCertName>" -KeySpec Signature
Run Code Online (Sandbox Code Playgroud) 当使用自签名证书与 REST API 建立 Https 连接时,我在 Android 9 中收到错误 javax.net.ssl.SSLPeerUnverifiedException: Hostname 196.1X.3X.X2 未验证。但它适用于Android(Pie)之前的Android版本。我把主机名是正确的。该怎么办 ?提前致谢。
我的代码如下。
public static String getResponse(String url) {
URL updateURL ;
HttpsURLConnection connection = null;
try {
HostnameVerifier hostnameVerifier = ( hostname, session ) ->{
HostnameVerifier hv =
HttpsURLConnection.getDefaultHostnameVerifier();
return hv.verify(Common.getHostnameSubject()+"", session ) ;
};
updateURL = new URL(url);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
InputStream caInput = AppApplication.getAppContext().
getAssets().open(Common.getCertificateAssetName());
Certificate ca;
ca = cf.generateCertificate(caInput);
caInput.close();
String keyStoreType = KeyStore.getDefaultType();
KeyStore keyStore = KeyStore.getInstance(keyStoreType);
keyStore.load(null, null);
keyStore.setCertificateEntry("ca", ca);
String …Run Code Online (Sandbox Code Playgroud) 我有一个 Asp.net API 网站,它执行自定义客户端证书验证。在 IIS 10 上托管此网站时,当我调用 API 时,我会从失败的请求日志中获取以下信息。
证书链已处理,但终止于信任提供者不信任的根证书。
我的 web.config 有
<configuration>
<system.webServer>
<access sslFlags="Ssl, SslRequireCert" />
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
在 applicationHost.config 我有
<section name="access" overrideModeDefault="Allow" />
Run Code Online (Sandbox Code Playgroud)
我在这里缺少什么?如何将 IIS 配置为仅传递证书而不验证它?
我想要这样做的原因是,这是一个测试环境,我想信任所有使用自签名证书调用我的 API 的客户端。我将在 API 内部验证证书。
注意:我在 Azure AppService 上托管相同的网站,并将“传入客户端证书”设置为ON。它就像一个魅力。那么,当我将其托管在我的机器 IIS 上时有什么区别?
我正在尝试更新本文的代码,以允许我创建(和使用)基于 ECC 的自签名证书,并使用它进行基本的签名和验证( ECDSA)。
根据这篇文章,我需要使用the more standard id-ecc类型
cryptography public-key .net-core .net-4.6 self-signed-certificate
我使用这个创建了一个自签名证书
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
-keyout myKey.key \
-new \
-out myCert.crt \
-subj /CN=my.domaine.any \
-config ./myConfig.cnf \
-reqexts SAN \
-extensions SAN \
-sha256 \
-days 365
Run Code Online (Sandbox Code Playgroud)
myConfig 的内容是
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
req_extensions = SAN
extensions = SAN
[ req_distinguished_name ]
countryName = myCountry
stateOrProvinceName = myProvince
localityName = myCity
organizationName = myOrgan
[SAN]
subjectAltName = DNS:my.domaine.any
extendedKeyUsage = serverAuth
Run Code Online (Sandbox Code Playgroud)
我检查了我在这里找到的 IOS 证书要求https://support.apple.com/en-us/HT210176(我希望,我拥有一切)。
我可以将证书安装到“设置”>“常规”>“配置文件”中。 …
我有以下示例代码,我使用自签名证书生成签名
public static String generateSignature(String data) throws Exception {
System.out.println("@@inside generateSignature: " + data);
String signature;
String jksFilepath = "E:\\test.jks";
try {
// Adding Security Provider for PKCS 12
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
// Setting password for the e-Token
// logging into token
ks = KeyStore.getInstance("jks");
FileInputStream fileInputStream = new FileInputStream(jksFilepath);
// Loading Keystore
// System.out.println("loading keystore");
ks.load(fileInputStream, JKSPassword);
Enumeration<String> e = ks.aliases();
while (e.hasMoreElements()) {
alias = e.nextElement();
// System.out.println("Alias of the e-Token : "+ alias);
UserCert = (X509Certificate) ks.getCertificate(alias);
UserCertPubKey …Run Code Online (Sandbox Code Playgroud) .net-4.6 ×1
.net-core ×1
android ×1
asp.net ×1
certificate ×1
cryptography ×1
iis-10 ×1
ios ×1
java ×1
makecert ×1
openssl ×1
php ×1
powershell ×1
public-key ×1
ssl ×1