當前位置: 首頁>>代碼示例>>Java>>正文


Java TripleDESCBC類代碼示例

本文整理匯總了Java中org.apache.sshd.common.cipher.TripleDESCBC的典型用法代碼示例。如果您正苦於以下問題:Java TripleDESCBC類的具體用法?Java TripleDESCBC怎麽用?Java TripleDESCBC使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TripleDESCBC類屬於org.apache.sshd.common.cipher包,在下文中一共展示了TripleDESCBC類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

import org.apache.sshd.common.cipher.TripleDESCBC; //導入依賴的package包/類
public static byte[] update(Mode mode, String key, byte[] data) throws Exception
{
    checkState(!isNullOrEmpty(key));
    checkNotNull(data);
    
    TripleDESCBC des = new TripleDESCBC();
    des.init(mode, key.getBytes(), key.getBytes());
    des.update(data, 0, data.length);
    
    return data;
}
 
開發者ID:alessandroleite,項目名稱:dohko,代碼行數:12,代碼來源:TripleDESUtils.java

示例2: createCipherFactoryList

import org.apache.sshd.common.cipher.TripleDESCBC; //導入依賴的package包/類
/**
 * create a list of factories from a list of cipher names
 */
@SuppressWarnings("unchecked")
public static List<NamedFactory<Cipher>> createCipherFactoryList(List<String> cipherNames) {

    final NamedFactory<Cipher>[] cipherArray = new NamedFactory[] { //
                    //
                                    new AES128CTR.Factory(), //
                                    new AES256CTR.Factory(), //
                                    new ARCFOUR128.Factory(), //
                                    new ARCFOUR256.Factory(), //
                                    new AES128CBC.Factory(), //
                                    new TripleDESCBC.Factory(), //
                                    new BlowfishCBC.Factory(), //
                                    new AES192CBC.Factory(), //
                                    new AES256CBC.Factory(), //
                    };

    // first get all of the ciphers we know about in a set
    final Map<String, NamedFactory<Cipher>> nameMap = new HashMap<>();

    final boolean useDefaults;
    if (cipherNames.size() <= 0) {
        useDefaults = true;
        cipherNames = new ArrayList<>(cipherArray.length);
    } else {
        useDefaults = false;

    }

    for (NamedFactory<Cipher> cipherFactory : cipherArray) {
        nameMap.put(cipherFactory.getName(), cipherFactory);
        if (useDefaults) {
            cipherNames.add(cipherFactory.getName());
        }
    }

    final List<NamedFactory<Cipher>> available = new ArrayList<>(cipherArray.length);

    for (String cipherName : cipherNames) {
        final NamedFactory<Cipher> factory = nameMap.get(cipherName);
        if (null == factory) {
            continue;
        }


        try {
            final Cipher c = factory.create();
            final byte[] key = new byte[c.getBlockSize()];
            final byte[] iv = new byte[c.getIVSize()];
            c.init(Cipher.Mode.Encrypt, key, iv);
            available.add(factory);
        } catch (Exception e) {
            LOGGER.info("Failed to load cipher " + cipherName
                            + " ensure you have the unlimited strength JCE installed");
        }
    }

    return available;
}
 
開發者ID:yahoo,項目名稱:artifactory_ssh_proxy,代碼行數:62,代碼來源:SshdProxySettings.java


注:本文中的org.apache.sshd.common.cipher.TripleDESCBC類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。