我用certutil
创建一个dbmyproject/bin/pkcert
echo "dartdart" > pwdfile
certutil -N -d 'sql:./' -f pwdfile
然后,我导入由权威机构验证的证书
certutil -d "sql:./" -A -t "C,C,C" -n "my_cert" -i certificate.crt
我检查它是否有效
certutil -L -d 'sql:./'
Certificate Nickname Trust Attributes
SSL,S/MIME,JAR/XPI
my_cert C,C,C
我的main.dart
library main;
import "dart:io";
void main() {
var testPkcertDatabase = Platform.script.resolve('./pkcert')
.toFilePath();
SecureSocket.initialize(database: testPkcertDatabase,
password: 'dartdart');
HttpServer
.bindSecure(InternetAddress.ANY_IP_V6,
8443,
certificateName: 'my_cert')
.then((server) {
server.listen((HttpRequest request) {
request.response.write('Hello, world!');
request.response.close();
});
});
}
我执行,我收到此错误:
Uncaught Error: CertificateException: Cannot find server certificate by nickname: my_cert (OS Error: security library: read-only database., errno = -8126)
我错过了什么,或者我应该报告错误?
谢谢。
答案 0 :(得分:0)
您是否尝试将-s "cn=mycert"
添加到
certutil -d "sql:./" -A -t "C,C,C" -n "my_cert" -i certificate.crt
并将其与
一起使用HttpServer
.bindSecure(InternetAddress.ANY_IP_V6,
8443,
certificateName: 'CN=my_cert')