我用certutil 创建一个数据库
myproject/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
我的主要部分
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)
我错过了什么,或者我应该报告一个错误?
谢谢。
您是否尝试将-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')
如本文所示http://jamesslocum.com/post/70003236123?