NHibernate. Linq LockMode

Часть кода первоначально со Склада В качестве примера для списка всех псевдонимов в базе ключей:

    // Load input stream into keystore
    keystore.load(is, password.toCharArray());

    // List the aliases
    Enumeration aliases = keystore.aliases();
    for (; aliases.hasMoreElements(); ) {
        String alias = (String)aliases.nextElement();

        // Does alias refer to a private key?
        boolean b = keystore.isKeyEntry(alias);

        // Does alias refer to a trusted certificate?
        b = keystore.isCertificateEntry(alias);
    }

экспорт закрытых ключей подошел на форумы Sun несколько месяцев назад, и , u:turingcompleter придумал класс DumpPrivateKey для сшивания в приложение.

import java.io.FileInputStream;
import java.security.Key;
import java.security.KeyStore;
import sun.misc.BASE64Encoder;

public class DumpPrivateKey {
     /**
     * Provides the missing functionality of keytool
     * that Apache needs for SSLCertificateKeyFile.
     *
     * @param args  
    *
  • [0] Keystore filename. *
  • [1] Keystore password. *
  • [2] alias *
*/ static public void main(String[] args) throws Exception { if(args.length < 3) { throw new IllegalArgumentException("expected args: Keystore filename, Keystore password, alias,

Примечание: этот пакет Sun использования, , который является "плохой вещью" .
, Если можно загрузить апачский код свободного городского населения , вот версия, которая скомпилирует без предупреждения:

javac -classpath .:commons-codec-1.4/commons-codec-1.4.jar DumpPrivateKey.java

и даст тот же результат:

import java.io.FileInputStream;
import java.security.Key;
import java.security.KeyStore;
//import sun.misc.BASE64Encoder;
import org.apache.commons.codec.binary.Base64;

public class DumpPrivateKey {
     /**
     * Provides the missing functionality of keytool
     * that Apache needs for SSLCertificateKeyFile.
     *
     * @param args  
    *
  • [0] Keystore filename. *
  • [1] Keystore password. *
  • [2] alias *
*/ static public void main(String[] args) throws Exception { if(args.length < 3) { throw new IllegalArgumentException("expected args: Keystore filename, Keystore password, alias,

можно использовать его как так:

java -classpath .:commons-codec-1.4/commons-codec-1.4.jar DumpPrivateKey $HOME/.keystore changeit tomcat

5
задан mxmissile 17 September 2009 в 19:47
поделиться