项目:vespa
文件:PemKeyStore.java
/**
* The user is responsible for closing any readers given in the parameter.
*/
@Override
public synchronized void engineLoad(LoadStoreParameter parameter) throws IOException {
if (storeRole != null)
throw new IllegalStateException("Already initialized.");
if (parameter instanceof KeyStoreLoadParameter) {
storeRole = new KeyStoreRole();
loadKeyStore((KeyStoreLoadParameter) parameter);
} else if (parameter instanceof TrustStoreLoadParameter) {
storeRole = new TrustStoreRole();
loadTrustStore((TrustStoreLoadParameter) parameter);
} else {
throw new IllegalArgumentException("Expected key store or trust store load parameter,got " + parameter.getClass());
}
}
@Override
public void engineLoad(LoadStoreParameter param) throws IOException,NoSuchAlgorithmException,CertificateException {
if (param == null) {
engineLoad(null,null);
return;
}
ProtectionParameter pParam = param.getProtectionParameter();
if (pParam == null) {
throw new NoSuchAlgorithmException();
}
if (pParam instanceof PasswordProtection) {
char[] password = ((PasswordProtection) pParam).getpassword();
if (password == null) {
throw new NoSuchAlgorithmException();
} else {
return;
}
}
throw new CertificateException();
}
@Override
public void enginestore(LoadStoreParameter param) throws IOException,CertificateException {
if (param == null) {
throw new IOException();
}
ProtectionParameter pParam = param.getProtectionParameter();
if (pParam instanceof PasswordProtection) {
char[] password = ((PasswordProtection) pParam).getpassword();
if (password == null) {
throw new NoSuchAlgorithmException();
} else if (password.length == 0) {
throw new CertificateException();
}
return;
}
throw new UnsupportedOperationException();
}
项目:commons-eid
文件:BeIDKeyStore.java
@Override
public void engineLoad(final LoadStoreParameter param)
throws IOException,CertificateException {
LOGGER.debug("engineLoad"); /*
* Allows for a KeyStore to be re-loaded
* several times.
*/
this.beIDCard = null;
this.authnCertificateChain = null;
this.signCertificateChain = null;
this.rrnCertificateChain = null;
this.authnCertificate = null;
this.signCertificate = null;
this.citizenCaCertificate = null;
this.rootCaCertificate = null;
this.rrnCertificate = null;
if (null == param) {
return;
}
if (param instanceof BeIDKeyStoreParameter) {
this.keyStoreParameter = (BeIDKeyStoreParameter) param;
return;
}
if (param instanceof JFrame) {
this.keyStoreParameter = new BeIDKeyStoreParameter();
JFrame frame = (JFrame) param;
this.keyStoreParameter.setParentComponent(frame);
return;
}
throw new NoSuchAlgorithmException();
}
项目:Aki-SSL
文件:PKCS12KeyStoreSpi.java
public void enginestore(LoadStoreParameter param)
throws IOException,CertificateException
{
if (param == null)
{
throw new IllegalArgumentException("'param' arg cannot be null");
}
if (!(param instanceof PKCS12StoreParameter || param instanceof JDKPKCS12StoreParameter))
{
throw new IllegalArgumentException(
"No support for 'param' of type " + param.getClass().getName());
}
PKCS12StoreParameter bcParam;
if (param instanceof PKCS12StoreParameter)
{
bcParam = (PKCS12StoreParameter)param;
}
else
{
bcParam = new PKCS12StoreParameter(((JDKPKCS12StoreParameter)param).getoutputStream(),param.getProtectionParameter(),((JDKPKCS12StoreParameter)param).isUseDEREncoding());
}
char[] password;
ProtectionParameter protParam = param.getProtectionParameter();
if (protParam == null)
{
password = null;
}
else if (protParam instanceof KeyStore.PasswordProtection)
{
password = ((KeyStore.PasswordProtection)protParam).getpassword();
}
else
{
throw new IllegalArgumentException(
"No support for protection parameter of type " + protParam.getClass().getName());
}
doStore(bcParam.getoutputStream(),password,bcParam.isForDEREncoding());
}
项目:commons-eid
文件:BeIDKeyStore.java
项目:RipplePower
文件:PKCS12KeyStoreSpi.java
项目:ripple-lib-java
文件:PKCS12KeyStoreSpi.java
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。