类sun.security.pkcs11.SunPKCS11出错

时间:2015-09-03 10:22:30

标签: java keystore

我使用此代码在java1.4中创建了keyStore。

<form name='reservation' action='http://resa...' method="POST" id="reservation" onsubmit="_gaq.push(['_linkByPost', this]);">

<input type="hidden" id="productLive" name="product" value="{$product.info.code}"/>
<input type="hidden" name="complementaryParameters" value=""/>

<input type="text" name="depCityCode" id="depCityCode" style="display:none"  />
<input type="text" name="dateDep" id="dateDep" style="display:none" />
<input type="text" name="nightDuration" id="nightDuration"  style="display:none" />
<input type="text" name="dayDuration" id="dayDuration"  style="display:none" />
<input type="text" name="provider" value="{$product.tourOperator.code}" style="display:none" />
<input type="text" name="toCode" id="toProduct" value="{$product.info.toProductCode}" style="display:none" />
<input type="text" name="catalogCode" value="{$product.info.code}" style="display:none" />
{{--@if($ecall)
<input type="text" name="reservationProfileChannelCode" value="ECALL" style="display:none" />
@else
<input type="text" name="reservationProfileChannelCode" value="ADV" style="display:none" />
@endif--}}
<input type="text" name="nbAdults" id="nbAdults" style="display:none" />
<input type="text" name="nbChildren" id="nbChildren" style="display:none" />
<input type="text" name="nbBabies" id="nbBabies" style="display:none" />
<input type="text" name="productUrl" id="productUrl" style="display:none" value="http://www.agencedevoyage.com/{$product.slug}_{$product.info.code}.html" />
<input type="text" name="homeUrl" id="homeUrl" style="display:none" value="http://www.agencedevoyage.com" />
<span id="ageChild" style="display:none"></span>

<div class="update-search clearfix">
    <div id="formulaireChoixSejour">
        <h2 style="padding-bottom: 10px">Choisissez le séjour qui vous convient le <span class="nowrap">mieux :<span></h2>
        <div class="changeClass"> <!-- Séparation pour tablette et inf -->
            <div class="col-xs-3 changeSubClass3">
                <label>Ville de départ :</label>
                <div class="selector">
                    <select id="departureCitys">
                        <option></option>
                    </select><span class="custom-select full-width" > <!-- Maël : Valeur a varier pour affichage --> </span>
                </div>
            </div>
            <div class="col-xs-2 changeSubClass2">
                <label id="bug4">Date de départ :</label>
                <div class="selector">
                    <select id="departureDates">
                        <option></option>
                    </select><span class="custom-select full-width"></span>
                </div>
            </div>
        </div>
        <div class="changeClass">
            <div class="col-xs-2 changeSubClass2">
                <label>Durée :</label>
                <div class="selector">
                    <select id="departureDurations">
                        <option></option>
                    </select><span class="custom-select full-width"></span>
                </div>
            </div>
            <div class="col-xs-2 changeSubClass2">
                <label>Formule(s) :</label>
                <div class="selector">
                    <select id="departureMealPlans">
                        <option></option>
                    </select><span class="custom-select full-width"></span>
                </div>
            </div>
            <div class="col-xs-2 changeSubClass2">
                <label id="bug2">Prix TTC<br/>par<br/>personne :</label>
            </div>
            <div class="col-xs-1 changeSubClass1">
            </div>
        </div>
    </div>
    <div id="bug3"></div>
    <div id='errorMessage'>Désolé il n'y a pas de produit correspondant à votre demande.</div>
    @foreach($dispos as $key => $dispo)
        <div class="productsDispo">
            <div class="changeClass">
                <div class="col-xs-3 changeSubClass33 depCityCode_" value="{{$dispo -> City -> code}}">
                    {{$dispo -> City -> name}}
                </div>
                <div class="col-xs-2 changeSubClass32 dateDep_" value="{{$dispo -> go }}">
                    {{$dispo -> go}}
                </div>
                <div class="col-xs-2 changeSubClass32 productDuration">
                    <span class="dayDuration_">{{$dispo -> nb_days}}</span>j / <span class="nightDuration_">{{$dispo -> nb_nights}}</span>n
                </div>
            </div>
            <div class="changeClass bug6">
                <div class="col-xs-2 changeSubClass32 mealPlan value="{{$dispo -> formula -> slug}}">
                {{$dispo -> formula->name}}
            </div>
            <div class="col-xs-2 changeSubClass32 priceProd">
                {{$dispo -> price}}€
            </div>
            <div class="col-xs-1 changeSubClass31">
                <button class="reservationGo bug5" a="#">Réserver</button>
            </div>
        </div>
</div>
@endforeach
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
    @include('common.function_fullFillForm')
</script>

</div>

但我收到了错误

 `public static void main(String[] args )
      throws IOException, DocumentException, GeneralSecurityException {
String pkcs11Config = "name=eToken\nlibrary=C://WINDOWS//system32//eTPKCS11.dll";
java.io.ByteArrayInputStream pkcs11ConfigStream = new java.io.ByteArrayInputStream(pkcs11Config.getBytes());
sun.security.pkcs11.SunPKCS11 providerPKCS11 = new   sun.security.pkcs11.SunPKCS11(pkcs11ConfigStream);
java.security.Security.addProvider(providerPKCS11);

// Get provider KeyStore and login with PIN
String pin = "123456";
 java.security.KeyStore keyStore =java.security.KeyStore.getInstance("PKCS11", providerPKCS11);
keyStore.load(null, pin.toCharArray());

// Enumerate items (certificates and private keys) in the KeyStore
java.util.Enumeration<String> aliases = keyStore.aliases();
String alias=null;
while (aliases.hasMoreElements()) {
 alias = aliases.nextElement();
System.out.println(alias);

 }}    

请告诉我解决方案。如何下载49以下的版本,如48等。

1 个答案:

答案 0 :(得分:1)

SunPKCS11是在Java 1.5中引入的

您必须升级Java版本或仍然无法使用它。

提升项目并不常见。 &#34;该项目已在运行&#34;并不是避免这种情况的理由,因为它是持续发展过程中预期的一部分。