Example usage for org.bouncycastle.bcpg SymmetricKeyAlgorithmTags TRIPLE_DES

List of usage examples for org.bouncycastle.bcpg SymmetricKeyAlgorithmTags TRIPLE_DES

Introduction

In this page you can find the example usage for org.bouncycastle.bcpg SymmetricKeyAlgorithmTags TRIPLE_DES.

Prototype

int TRIPLE_DES

To view the source code for org.bouncycastle.bcpg SymmetricKeyAlgorithmTags TRIPLE_DES.

Click Source Link

Usage

From source file:genkeys.java

License:Open Source License

private static String symmetricCipherName(int algorithm) throws PGPException {
    switch (algorithm) {
    case SymmetricKeyAlgorithmTags.NULL:
        return null;
    case SymmetricKeyAlgorithmTags.TRIPLE_DES:
        return "DESEDE";
    case SymmetricKeyAlgorithmTags.IDEA:
        return "IDEA";
    case SymmetricKeyAlgorithmTags.CAST5:
        return "CAST5";
    case SymmetricKeyAlgorithmTags.BLOWFISH:
        return "Blowfish";
    case SymmetricKeyAlgorithmTags.SAFER:
        return "SAFER";
    case SymmetricKeyAlgorithmTags.DES:
        return "DES";
    case SymmetricKeyAlgorithmTags.AES_128:
        return "AES";
    case SymmetricKeyAlgorithmTags.AES_192:
        return "AES";
    case SymmetricKeyAlgorithmTags.AES_256:
        return "AES";
    case SymmetricKeyAlgorithmTags.TWOFISH:
        return "Twofish";
    default://from w  w w. j  av  a  2s  .c  o m
        throw new PGPException("unknown symmetric algorithm: " + algorithm);
    }
}

From source file:divconq.pgp.PGPUtil.java

License:Open Source License

public static String getSymmetricCipherName(int algorithm) {
    switch (algorithm) {
    case SymmetricKeyAlgorithmTags.NULL:
        return null;
    case SymmetricKeyAlgorithmTags.TRIPLE_DES:
        return "DESEDE";
    case SymmetricKeyAlgorithmTags.IDEA:
        return "IDEA";
    case SymmetricKeyAlgorithmTags.CAST5:
        return "CAST5";
    case SymmetricKeyAlgorithmTags.BLOWFISH:
        return "Blowfish";
    case SymmetricKeyAlgorithmTags.SAFER:
        return "SAFER";
    case SymmetricKeyAlgorithmTags.DES:
        return "DES";
    case SymmetricKeyAlgorithmTags.AES_128:
        return "AES";
    case SymmetricKeyAlgorithmTags.AES_192:
        return "AES";
    case SymmetricKeyAlgorithmTags.AES_256:
        return "AES";
    case SymmetricKeyAlgorithmTags.CAMELLIA_128:
        return "Camellia";
    case SymmetricKeyAlgorithmTags.CAMELLIA_192:
        return "Camellia";
    case SymmetricKeyAlgorithmTags.CAMELLIA_256:
        return "Camellia";
    case SymmetricKeyAlgorithmTags.TWOFISH:
        return "Twofish";
    default://ww  w.java2s. com
        throw new IllegalArgumentException("unknown symmetric algorithm: " + algorithm);
    }
}

From source file:org.apache.camel.converter.crypto.PGPDataFormatTest.java

License:Apache License

protected int getAlgorithm() {
    return SymmetricKeyAlgorithmTags.TRIPLE_DES;
}

From source file:org.sufficientlysecure.keychain.support.KeyringBuilder.java

License:Open Source License

private static SignaturePacket createSignaturePacket(BigInteger signature) {
    MPInteger[] signatureArray = new MPInteger[] { new MPInteger(signature) };

    int signatureType = PGPSignature.POSITIVE_CERTIFICATION;
    int keyAlgorithm = SignaturePacket.RSA_GENERAL;
    int hashAlgorithm = HashAlgorithmTags.SHA1;

    SignatureSubpacket[] hashedData = new SignatureSubpacket[] {
            new SignatureCreationTime(false, SIGNATURE_DATE),
            new KeyFlags(false, KeyFlags.CERTIFY_OTHER + KeyFlags.SIGN_DATA),
            new KeyExpirationTime(false, TimeUnit.DAYS.toSeconds(2)),
            new PreferredAlgorithms(SignatureSubpacketTags.PREFERRED_SYM_ALGS, false,
                    new int[] { SymmetricKeyAlgorithmTags.AES_256, SymmetricKeyAlgorithmTags.AES_192,
                            SymmetricKeyAlgorithmTags.AES_128, SymmetricKeyAlgorithmTags.CAST5,
                            SymmetricKeyAlgorithmTags.TRIPLE_DES }),
            new PreferredAlgorithms(SignatureSubpacketTags.PREFERRED_HASH_ALGS, false,
                    new int[] { HashAlgorithmTags.SHA256, HashAlgorithmTags.SHA1, HashAlgorithmTags.SHA384,
                            HashAlgorithmTags.SHA512, HashAlgorithmTags.SHA224 }),
            new PreferredAlgorithms(SignatureSubpacketTags.PREFERRED_COMP_ALGS, false,
                    new int[] { CompressionAlgorithmTags.ZLIB, CompressionAlgorithmTags.BZIP2,
                            CompressionAlgorithmTags.ZIP }),
            new Features(false, Features.FEATURE_MODIFICATION_DETECTION),
            createPreferencesSignatureSubpacket() };
    SignatureSubpacket[] unhashedData = new SignatureSubpacket[] {
            new IssuerKeyID(false, false, KEY_ID.toByteArray()) };
    byte[] fingerPrint = new BigInteger("522c", 16).toByteArray();

    return new SignaturePacket(signatureType, KEY_ID.longValue(), keyAlgorithm, hashAlgorithm, hashedData,
            unhashedData, fingerPrint, signatureArray);
}