만약 내가 특정 알고리즘으로 파일을 인코딩하고, 디코딩하며 보안을 철저히 하고 싶을때..

또는 통신 알고리즘상에서 스푸핑을 방지하고 싶을때..

 

또는 DB 설정파일을 보안화하고 싶을때..

 

그냥 자바를 보면 답이 나온다.

 

 

 import java.util.Iterator;
import java.security.Security;
import java.security.Provider;

public class PrintProviders {
    public static void main(String[] args) {
        Provider[] providers = Security.getProviders();
        for (int i = 0; i < providers.length; i++) {
            String name = providers[i].getName();
            String info = providers[i].getInfo();
            double version = providers[i].getVersion();
            System.out.println("-------------------------------------");
            System.out.println("name: " + name);
            System.out.println("info: " + info);
            System.out.println("version: " + version);

            for (Iterator iter = providers[i].keySet().iterator(); iter
                    .hasNext();) {
                String key = (String) iter.next();
                System.out.println("\t" + key + "\t"
                        + providers[i].getProperty(key));
            }

            System.out.println("-------------------------------------");

        }
    }
}

 

 

자바에서는 Security 알고리즘이 무상하게 제공되고 있다.

 

위의 소스의 결과를 볼까?

 

 -------------------------------------
name: SUN
info: SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; JavaLoginConfig Configuration)
version: 1.6
 Alg.Alias.Signature.SHA1/DSA SHA1withDSA
 Alg.Alias.Signature.1.2.840.10040.4.3 SHA1withDSA
 Alg.Alias.Signature.DSS SHA1withDSA
 SecureRandom.SHA1PRNG ImplementedIn Software
 KeyStore.JKS sun.security.provider.JavaKeyStore$JKS
 Alg.Alias.MessageDigest.SHA-1 SHA
 MessageDigest.SHA sun.security.provider.SHA
 KeyStore.CaseExactJKS sun.security.provider.JavaKeyStore$CaseExactJKS
 CertStore.com.sun.security.IndexedCollection ImplementedIn Software
 Alg.Alias.Signature.DSA SHA1withDSA
 KeyFactory.DSA ImplementedIn Software
 KeyStore.JKS ImplementedIn Software
 AlgorithmParameters.DSA ImplementedIn Software
 Signature.NONEwithDSA sun.security.provider.DSA$RawDSA
 Alg.Alias.CertificateFactory.X509 X.509
 CertStore.com.sun.security.IndexedCollection sun.security.provider.certpath.IndexedCollectionCertStore
 Provider.id className sun.security.provider.Sun
 Alg.Alias.Signature.SHA-1/DSA SHA1withDSA
 CertificateFactory.X.509 ImplementedIn Software
 Signature.SHA1withDSA KeySize 1024
 KeyFactory.DSA sun.security.provider.DSAKeyFactory
 CertPathValidator.PKIX ImplementedIn Software
 Configuration.JavaLoginConfig sun.security.provider.ConfigSpiFile
 Alg.Alias.Signature.OID.1.2.840.10040.4.3 SHA1withDSA
 Alg.Alias.KeyFactory.1.2.840.10040.4.1 DSA
 MessageDigest.MD5 ImplementedIn Software
 Alg.Alias.Signature.RawDSA NONEwithDSA
 Provider.id name SUN
 Alg.Alias.AlgorithmParameters.1.2.840.10040.4.1 DSA
 CertPathBuilder.PKIX ValidationAlgorithm RFC3280
 Policy.JavaPolicy sun.security.provider.PolicySpiFile
 Alg.Alias.AlgorithmParameters.1.3.14.3.2.12 DSA
 Alg.Alias.Signature.SHA/DSA SHA1withDSA
 Alg.Alias.KeyPairGenerator.1.3.14.3.2.12 DSA
 MessageDigest.SHA-384 sun.security.provider.SHA5$SHA384
 Signature.SHA1withDSA ImplementedIn Software
 AlgorithmParameterGenerator.DSA sun.security.provider.DSAParameterGenerator
 Signature.NONEwithDSA SupportedKeyClasses java.security.interfaces.DSAPublicKey|java.security.interfaces.DSAPrivateKey
 MessageDigest.SHA-512 sun.security.provider.SHA5$SHA512
 CertPathBuilder.PKIX sun.security.provider.certpath.SunCertPathBuilder
 Alg.Alias.Signature.1.3.14.3.2.27 SHA1withDSA
 CertPathBuilder.PKIX ImplementedIn Software
 Provider.id version 1.6
 AlgorithmParameters.DSA sun.security.provider.DSAParameters
 Signature.SHA1withDSA SupportedKeyClasses java.security.interfaces.DSAPublicKey|java.security.interfaces.DSAPrivateKey
 CertStore.Collection sun.security.provider.certpath.CollectionCertStore
 AlgorithmParameterGenerator.DSA ImplementedIn Software
 KeyPairGenerator.DSA KeySize 1024
 CertStore.LDAP sun.security.provider.certpath.LDAPCertStore
 CertificateFactory.X.509 sun.security.provider.X509Factory
 CertStore.LDAP LDAPSchema RFC2587
 CertStore.LDAP ImplementedIn Software
 KeyPairGenerator.DSA ImplementedIn Software
 CertPathValidator.PKIX ValidationAlgorithm RFC3280
 CertStore.Collection ImplementedIn Software
 Alg.Alias.Signature.1.3.14.3.2.13 SHA1withDSA
 CertPathValidator.PKIX sun.security.provider.certpath.PKIXCertPathValidator
 Alg.Alias.MessageDigest.SHA1 SHA
 AlgorithmParameterGenerator.DSA KeySize 1024
 SecureRandom.SHA1PRNG sun.security.provider.SecureRandom
 Signature.SHA1withDSA sun.security.provider.DSA$SHA1withDSA
 Alg.Alias.KeyFactory.1.3.14.3.2.12 DSA
 KeyPairGenerator.DSA sun.security.provider.DSAKeyPairGenerator
 MessageDigest.SHA ImplementedIn Software
 Provider.id info SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; JavaLoginConfig Configuration)
 Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1 DSA
 Alg.Alias.Signature.SHAwithDSA SHA1withDSA
 MessageDigest.MD5 sun.security.provider.MD5
 Alg.Alias.Signature.DSAWithSHA1 SHA1withDSA
 MessageDigest.SHA-256 sun.security.provider.SHA2
 Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1 DSA
 MessageDigest.MD2 sun.security.provider.MD2
-------------------------------------
-------------------------------------
name: SunRsaSign
info: Sun RSA signature provider
version: 1.5
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.4 MD5withRSA
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.2 MD2withRSA
 Alg.Alias.KeyFactory.1.2.840.113549.1.1 RSA
 Signature.SHA512withRSA SupportedKeyClasses java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey
 Provider.id version 1.5
 Signature.MD5withRSA SupportedKeyClasses java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey
 Alg.Alias.Signature.1.2.840.113549.1.1.13 SHA512withRSA
 KeyPairGenerator.RSA sun.security.rsa.RSAKeyPairGenerator
 Alg.Alias.Signature.1.2.840.113549.1.1.12 SHA384withRSA
 Alg.Alias.Signature.1.2.840.113549.1.1.11 SHA256withRSA
 KeyFactory.RSA sun.security.rsa.RSAKeyFactory
 Alg.Alias.Signature.1.3.14.3.2.29 SHA1withRSA
 Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.1 RSA
 Signature.MD2withRSA sun.security.rsa.RSASignature$MD2withRSA
 Signature.SHA384withRSA sun.security.rsa.RSASignature$SHA384withRSA
 Signature.MD5withRSA sun.security.rsa.RSASignature$MD5withRSA
 Provider.id info Sun RSA signature provider
 Signature.SHA1withRSA SupportedKeyClasses java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey
 Signature.SHA1withRSA sun.security.rsa.RSASignature$SHA1withRSA
 Alg.Alias.Signature.1.2.840.113549.1.1.5 SHA1withRSA
 Signature.SHA256withRSA sun.security.rsa.RSASignature$SHA256withRSA
 Alg.Alias.Signature.1.2.840.113549.1.1.4 MD5withRSA
 Provider.id className sun.security.rsa.SunRsaSign
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.13 SHA512withRSA
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.12 SHA384withRSA
 Alg.Alias.Signature.1.2.840.113549.1.1.2 MD2withRSA
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.11 SHA256withRSA
 Signature.MD2withRSA SupportedKeyClasses java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey
 Provider.id name SunRsaSign
 Alg.Alias.KeyFactory.OID.1.2.840.113549.1.1 RSA
 Signature.SHA384withRSA SupportedKeyClasses java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey
 Signature.SHA512withRSA sun.security.rsa.RSASignature$SHA512withRSA
 Signature.SHA256withRSA SupportedKeyClasses java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.5 SHA1withRSA
 Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1 RSA
-------------------------------------
-------------------------------------
name: SunJSSE
info: Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
version: 1.6
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.4 MD5withRSA
 Alg.Alias.KeyFactory.1.2.840.113549.1.1 RSA
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.2 MD2withRSA
 SSLContext.Default com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl
 Provider.id version 1.6
 TrustManagerFactory.SunX509 com.sun.net.ssl.internal.ssl.TrustManagerFactoryImpl$SimpleFactory
 KeyManagerFactory.NewSunX509 com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl$X509
 KeyPairGenerator.RSA sun.security.rsa.RSAKeyPairGenerator
 KeyStore.PKCS12 com.sun.net.ssl.internal.pkcs12.PKCS12KeyStore
 SSLContext.SSLv3 com.sun.net.ssl.internal.ssl.SSLContextImpl
 KeyFactory.RSA sun.security.rsa.RSAKeyFactory
 Alg.Alias.Signature.1.3.14.3.2.29 SHA1withRSA
 Alg.Alias.TrustManagerFactory.X509 PKIX
 Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.1 RSA
 Signature.MD5andSHA1withRSA com.sun.net.ssl.internal.ssl.RSASignature
 Signature.MD2withRSA sun.security.rsa.RSASignature$MD2withRSA
 Signature.MD5withRSA sun.security.rsa.RSASignature$MD5withRSA
 Provider.id info Sun JSSE provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
 Signature.SHA1withRSA sun.security.rsa.RSASignature$SHA1withRSA
 Alg.Alias.Signature.1.2.840.113549.1.1.5 SHA1withRSA
 Alg.Alias.Signature.1.2.840.113549.1.1.4 MD5withRSA
 Provider.id className com.sun.net.ssl.internal.ssl.Provider
 Alg.Alias.Signature.OID.1.3.14.3.2.29 SHA1withRSA
 Alg.Alias.Signature.1.2.840.113549.1.1.2 MD2withRSA
 Provider.id name SunJSSE
 SSLContext.SSL com.sun.net.ssl.internal.ssl.SSLContextImpl
 SSLContext.TLS com.sun.net.ssl.internal.ssl.SSLContextImpl
 TrustManagerFactory.PKIX com.sun.net.ssl.internal.ssl.TrustManagerFactoryImpl$PKIXFactory
 SSLContext.TLSv1 com.sun.net.ssl.internal.ssl.SSLContextImpl
 Alg.Alias.KeyFactory.OID.1.2.840.113549.1.1 RSA
 KeyManagerFactory.SunX509 com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl$SunX509
 Alg.Alias.TrustManagerFactory.SunPKIX PKIX
 Alg.Alias.TrustManagerFactory.X.509 PKIX
 Alg.Alias.Signature.OID.1.2.840.113549.1.1.5 SHA1withRSA
 Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1 RSA
-------------------------------------
-------------------------------------
name: SunJCE
info: SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
version: 1.6
 Cipher.Blowfish SupportedKeyFormats RAW
 AlgorithmParameters.DESede com.sun.crypto.provider.DESedeParameters
 AlgorithmParameters.DES com.sun.crypto.provider.DESParameters
 Cipher.DES SupportedPaddings NOPADDING|PKCS5PADDING|ISO10126PADDING
 AlgorithmParameters.Blowfish com.sun.crypto.provider.BlowfishParameters
 Cipher.DESedeWrap SupportedKeyFormats RAW
 Alg.Alias.KeyAgreement.1.2.840.113549.1.3.1 DiffieHellman
 AlgorithmParameterGenerator.DiffieHellman com.sun.crypto.provider.DHParameterGenerator
 Cipher.RSA SupportedPaddings NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING|OAEPWITHSHA1ANDMGF1PADDING|OAEPWITHSHA-1ANDMGF1PADDING|OAEPWITHSHA-256ANDMGF1PADDING|OAEPWITHSHA-384ANDMGF1PADDING|OAEPWITHSHA-512ANDMGF1PADDING
 Alg.Alias.Cipher.TripleDES DESede
 Cipher.ARCFOUR SupportedModes ECB
 Mac.SslMacSHA1 SupportedKeyFormats RAW
 KeyGenerator.DES com.sun.crypto.provider.DESKeyGenerator
 Provider.id version 1.6
 KeyGenerator.DESede com.sun.crypto.provider.DESedeKeyGenerator
 Alg.Alias.SecretKeyFactory.PBE PBEWithMD5AndDES
 Alg.Alias.KeyFactory.1.2.840.113549.1.3.1 DiffieHellman
 Mac.HmacSHA1 com.sun.crypto.provider.HmacSHA1
 Cipher.PBEWithMD5AndDES com.sun.crypto.provider.PBEWithMD5AndDESCipher
 Cipher.AES SupportedModes ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64|CFB72|CFB80|CFB88|CFB96|CFB104|CFB112|CFB120|CFB128|OFB72|OFB80|OFB88|OFB96|OFB104|OFB112|OFB120|OFB128
 Cipher.AESWrap SupportedModes ECB
 SecretKeyFactory.DESede com.sun.crypto.provider.DESedeKeyFactory
 KeyGenerator.SunTlsKeyMaterial com.sun.crypto.provider.TlsKeyMaterialGenerator
 AlgorithmParameters.OAEP com.sun.crypto.provider.OAEPParameters
 Cipher.AES SupportedKeyFormats RAW
 AlgorithmParameters.RC2 com.sun.crypto.provider.RC2Parameters
 AlgorithmParameters.PBE com.sun.crypto.provider.PBEParameters
 Alg.Alias.KeyPairGenerator.DH DiffieHellman
 Alg.Alias.KeyAgreement.OID.1.2.840.113549.1.3.1 DiffieHellman
 Cipher.AES com.sun.crypto.provider.AESCipher
 KeyGenerator.RC2 com.sun.crypto.provider.KeyGeneratorCore$RC2KeyGenerator
 Mac.HmacSHA512 com.sun.crypto.provider.HmacCore$HmacSHA512
 Provider.id info SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
 Cipher.AES SupportedPaddings NOPADDING|PKCS5PADDING|ISO10126PADDING
 Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.12.1.6 PBEWithSHA1AndRC2_40
 Cipher.Blowfish SupportedPaddings NOPADDING|PKCS5PADDING|ISO10126PADDING
 Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.12.1.3 PBEWithSHA1AndDESede
 KeyStore.JCEKS com.sun.crypto.provider.JceKeyStore
 Cipher.Blowfish SupportedModes ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64
 Alg.Alias.SecretKeyFactory.1.2.840.113549.1.5.12 PBKDF2WithHmacSHA1
 Mac.HmacSHA384 SupportedKeyFormats RAW
 Cipher.DESedeWrap com.sun.crypto.provider.DESedeWrapCipher
 Cipher.ARCFOUR SupportedPaddings NOPADDING
 Alg.Alias.KeyPairGenerator.1.2.840.113549.1.3.1 DiffieHellman
 Cipher.PBEWithMD5AndTripleDES com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher
 Alg.Alias.Cipher.1.2.840.113549.1.12.1.6 PBEWithSHA1AndRC2_40
 Alg.Alias.Cipher.1.2.840.113549.1.12.1.3 PBEWithSHA1AndDESede
 Mac.HmacSHA256 SupportedKeyFormats RAW
 Alg.Alias.AlgorithmParameterGenerator.1.2.840.113549.1.3.1 DiffieHellman
 Cipher.PBEWithSHA1AndDESede com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndDESede
 SecretKeyFactory.PBEWithMD5AndDES com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES
 KeyPairGenerator.DiffieHellman com.sun.crypto.provider.DHKeyPairGenerator
 Cipher.RC2 SupportedModes ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64
 Alg.Alias.AlgorithmParameters.Rijndael AES
 KeyAgreement.DiffieHellman SupportedKeyClasses javax.crypto.interfaces.DHPublicKey|javax.crypto.interfaces.DHPrivateKey
 Mac.HmacMD5 SupportedKeyFormats RAW
 KeyGenerator.SunTlsRsaPremasterSecret com.sun.crypto.provider.TlsRsaPremasterSecretGenerator
 Cipher.AESWrap SupportedKeyFormats RAW
 SecretKeyFactory.DES com.sun.crypto.provider.DESKeyFactory
 Cipher.AESWrap SupportedPaddings NOPADDING
 Provider.id name SunJCE
 KeyGenerator.HmacSHA512 com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG
 Mac.HmacSHA256 com.sun.crypto.provider.HmacCore$HmacSHA256
 Cipher.ARCFOUR SupportedKeyFormats RAW
 Cipher.DES SupportedModes ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64
 Cipher.RSA SupportedKeyClasses java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey
 SecretKeyFactory.PBEWithMD5AndTripleDES com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndTripleDES
 Cipher.PBEWithSHA1AndRC2_40 com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC2_40
 AlgorithmParameters.DiffieHellman com.sun.crypto.provider.DHParameters
 Mac.HmacMD5 com.sun.crypto.provider.HmacMD5
 Cipher.RSA com.sun.crypto.provider.RSACipher
 Mac.SslMacMD5 com.sun.crypto.provider.SslMacCore$SslMacMD5
 Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.5.3 PBEWithMD5AndDES
 Cipher.DESede SupportedPaddings NOPADDING|PKCS5PADDING|ISO10126PADDING
 Alg.Alias.AlgorithmParameterGenerator.OID.1.2.840.113549.1.3.1 DiffieHellman
 Cipher.DESede com.sun.crypto.provider.DESedeCipher
 Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.3.1 DiffieHellman
 Alg.Alias.AlgorithmParameters.1.2.840.113549.1.5.3 PBEWithMD5AndDES
 Mac.HmacSHA512 SupportedKeyFormats RAW
 Mac.HmacPBESHA1 SupportedKeyFormats RAW
 Alg.Alias.AlgorithmParameterGenerator.DH DiffieHellman
 Cipher.DESedeWrap SupportedPaddings NOPADDING
 Alg.Alias.SecretKeyFactory.OID.1.2.840.113549.1.5.12 PBKDF2WithHmacSHA1
 Alg.Alias.AlgorithmParameters.1.2.840.113549.1.3.1 DiffieHellman
 Mac.HmacPBESHA1 com.sun.crypto.provider.HmacPKCS12PBESHA1
 Cipher.DES SupportedKeyFormats RAW
 AlgorithmParameters.PBEWithMD5AndTripleDES com.sun.crypto.provider.PBEParameters
 Cipher.DESedeWrap SupportedModes CBC
 Alg.Alias.KeyFactory.OID.1.2.840.113549.1.3.1 DiffieHellman
 Alg.Alias.Cipher.OID.1.2.840.113549.1.5.3 PBEWithMD5AndDES
 AlgorithmParameters.AES com.sun.crypto.provider.AESParameters
 Alg.Alias.AlgorithmParameters.TripleDES DESede
 Alg.Alias.SecretKeyFactory.TripleDES DESede
 KeyGenerator.HmacSHA256 com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG
 Alg.Alias.KeyGenerator.TripleDES DESede
 Alg.Alias.AlgorithmParameters.DH DiffieHellman
 KeyGenerator.AES com.sun.crypto.provider.AESKeyGenerator
 Cipher.RC2 SupportedPaddings NOPADDING|PKCS5PADDING|ISO10126PADDING
 Alg.Alias.Cipher.RC4 ARCFOUR
 Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.3.1 DiffieHellman
 Mac.HmacSHA384 com.sun.crypto.provider.HmacCore$HmacSHA384
 SecretKeyFactory.PBKDF2WithHmacSHA1 com.sun.crypto.provider.PBKDF2HmacSHA1Factory
 Provider.id className com.sun.crypto.provider.SunJCE
 Cipher.DES com.sun.crypto.provider.DESCipher
 Cipher.Blowfish com.sun.crypto.provider.BlowfishCipher
 KeyGenerator.SunTlsMasterSecret com.sun.crypto.provider.TlsMasterSecretGenerator
 KeyGenerator.HmacSHA1 com.sun.crypto.provider.HmacSHA1KeyGenerator
 Alg.Alias.SecretKeyFactory.1.2.840.113549.1.5.3 PBEWithMD5AndDES
 KeyGenerator.SunTlsPrf com.sun.crypto.provider.TlsPrfGenerator
 SecretKeyFactory.PBEWithSHA1AndDESede com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede
 KeyGenerator.ARCFOUR com.sun.crypto.provider.KeyGeneratorCore$ARCFOURKeyGenerator
 Alg.Alias.KeyAgreement.DH DiffieHellman
 Alg.Alias.KeyGenerator.Rijndael AES
 AlgorithmParameters.PBEWithSHA1AndDESede com.sun.crypto.provider.PBEParameters
 Alg.Alias.KeyGenerator.RC4 ARCFOUR
 Alg.Alias.Cipher.OID.1.2.840.113549.1.12.1.6 PBEWithSHA1AndRC2_40
 Alg.Alias.Cipher.OID.1.2.840.113549.1.12.1.3 PBEWithSHA1AndDESede
 Mac.SslMacMD5 SupportedKeyFormats RAW
 Mac.HmacSHA1 SupportedKeyFormats RAW
 Cipher.DESede SupportedKeyFormats RAW
 Cipher.RC2 com.sun.crypto.provider.RC2Cipher
 SecretKeyFactory.PBEWithSHA1AndRC2_40 com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40
 KeyGenerator.HmacMD5 com.sun.crypto.provider.HmacMD5KeyGenerator
 AlgorithmParameters.PBEWithSHA1AndRC2_40 com.sun.crypto.provider.PBEParameters
 KeyGenerator.HmacSHA384 com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG
 Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.6 PBEWithSHA1AndRC2_40
 KeyFactory.DiffieHellman com.sun.crypto.provider.DHKeyFactory
 Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.3 PBEWithSHA1AndDESede
 AlgorithmParameters.PBEWithMD5AndDES com.sun.crypto.provider.PBEParameters
 Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.6 PBEWithSHA1AndRC2_40
 Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.3 PBEWithSHA1AndDESede
 Cipher.AESWrap com.sun.crypto.provider.AESWrapCipher
 Alg.Alias.SecretKeyFactory.OID.1.2.840.113549.1.5.3 PBEWithMD5AndDES
 Alg.Alias.Cipher.Rijndael AES
 Cipher.RSA SupportedModes ECB
 Cipher.DESede SupportedModes ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64
 Alg.Alias.SecretKeyFactory.OID.1.2.840.113549.1.12.1.6 PBEWithSHA1AndRC2_40
 Alg.Alias.SecretKeyFactory.OID.1.2.840.113549.1.12.1.3 PBEWithSHA1AndDESede
 Cipher.ARCFOUR com.sun.crypto.provider.ARCFOURCipher
 Alg.Alias.Cipher.1.2.840.113549.1.5.3 PBEWithMD5AndDES
 Mac.SslMacSHA1 com.sun.crypto.provider.SslMacCore$SslMacSHA1
 KeyAgreement.DiffieHellman com.sun.crypto.provider.DHKeyAgreement
 Cipher.RC2 SupportedKeyFormats RAW
 Alg.Alias.KeyFactory.DH DiffieHellman
 KeyGenerator.Blowfish com.sun.crypto.provider.BlowfishKeyGenerator
-------------------------------------
-------------------------------------
name: SunJGSS
info: Sun (Kerberos v5, SPNEGO)
version: 1.0
 GssApiMechanism.1.3.6.1.5.5.2 sun.security.jgss.spnego.SpNegoMechFactory
 Provider.id info Sun (Kerberos v5, SPNEGO)
 Provider.id className sun.security.jgss.SunProvider
 Provider.id version 1.0
 GssApiMechanism.1.2.840.113554.1.2.2 sun.security.jgss.krb5.Krb5MechFactory
 Provider.id name SunJGSS
-------------------------------------
-------------------------------------
name: SunSASL
info: Sun SASL provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
version: 1.5
 Provider.id className com.sun.security.sasl.Provider
 SaslClientFactory.CRAM-MD5 com.sun.security.sasl.ClientFactoryImpl
 Provider.id version 1.5
 SaslClientFactory.EXTERNAL com.sun.security.sasl.ClientFactoryImpl
 SaslClientFactory.DIGEST-MD5 com.sun.security.sasl.digest.FactoryImpl
 SaslClientFactory.PLAIN com.sun.security.sasl.ClientFactoryImpl
 Provider.id name SunSASL
 SaslClientFactory.GSSAPI com.sun.security.sasl.gsskerb.FactoryImpl
 SaslServerFactory.DIGEST-MD5 com.sun.security.sasl.digest.FactoryImpl
 SaslServerFactory.CRAM-MD5 com.sun.security.sasl.ServerFactoryImpl
 SaslServerFactory.GSSAPI com.sun.security.sasl.gsskerb.FactoryImpl
 Provider.id info Sun SASL provider(implements client mechanisms for: DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSAPI, CRAM-MD5)
-------------------------------------
-------------------------------------
name: XMLDSig
info: XMLDSig (DOM XMLSignatureFactory; DOM KeyInfoFactory)
version: 1.0
 Alg.Alias.TransformService.XPATH http://www.w3.org/TR/1999/REC-xpath-19991116
 TransformService.http://www.w3.org/TR/1999/REC-xslt-19991116 MechanismType DOM
 Provider.id version 1.0
 Alg.Alias.TransformService.INCLUSIVE http://www.w3.org/TR/2001/REC-xml-c14n-20010315
 TransformService.http://www.w3.org/2000/09/xmldsig#base64 MechanismType DOM
 Alg.Alias.TransformService.EXCLUSIVE http://www.w3.org/2001/10/xml-exc-c14n#
 KeyInfoFactory.DOM org.jcp.xml.dsig.internal.dom.DOMKeyInfoFactory
 TransformService.http://www.w3.org/2001/10/xml-exc-c14n#WithComments org.jcp.xml.dsig.internal.dom.DOMExcC14NMethod
 Alg.Alias.TransformService.INCLUSIVE_WITH_COMMENTS http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments
 TransformService.http://www.w3.org/2002/06/xmldsig-filter2 MechanismType DOM
 TransformService.http://www.w3.org/TR/1999/REC-xpath-19991116 MechanismType DOM
 TransformService.http://www.w3.org/2001/10/xml-exc-c14n# org.jcp.xml.dsig.internal.dom.DOMExcC14NMethod
 XMLSignatureFactory.DOM org.jcp.xml.dsig.internal.dom.DOMXMLSignatureFactory
 Alg.Alias.TransformService.XPATH2 http://www.w3.org/2002/06/xmldsig-filter2
 TransformService.http://www.w3.org/2001/10/xml-exc-c14n# MechanismType DOM
 TransformService.http://www.w3.org/2001/10/xml-exc-c14n#WithComments MechanismType DOM
 TransformService.http://www.w3.org/TR/1999/REC-xslt-19991116 org.jcp.xml.dsig.internal.dom.DOMXSLTTransform
 TransformService.http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14NMethod
 Alg.Alias.TransformService.BASE64 http://www.w3.org/2000/09/xmldsig#base64
 Alg.Alias.TransformService.ENVELOPED http://www.w3.org/2000/09/xmldsig#enveloped-signature
 Provider.id info XMLDSig (DOM XMLSignatureFactory; DOM KeyInfoFactory)
 TransformService.http://www.w3.org/TR/2001/REC-xml-c14n-20010315 org.jcp.xml.dsig.internal.dom.DOMCanonicalXMLC14NMethod
 Provider.id className org.jcp.xml.dsig.internal.dom.XMLDSigRI
 Alg.Alias.TransformService.EXCLUSIVE_WITH_COMMENTS http://www.w3.org/2001/10/xml-exc-c14n#WithComments
 TransformService.http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments MechanismType DOM
 TransformService.http://www.w3.org/2002/06/xmldsig-filter2 org.jcp.xml.dsig.internal.dom.DOMXPathFilter2Transform
 TransformService.http://www.w3.org/2000/09/xmldsig#enveloped-signature org.jcp.xml.dsig.internal.dom.DOMEnvelopedTransform
 Provider.id name XMLDSig
 TransformService.http://www.w3.org/2000/09/xmldsig#base64 org.jcp.xml.dsig.internal.dom.DOMBase64Transform
 TransformService.http://www.w3.org/TR/1999/REC-xpath-19991116 org.jcp.xml.dsig.internal.dom.DOMXPathTransform
 TransformService.http://www.w3.org/TR/2001/REC-xml-c14n-20010315 MechanismType DOM
 Alg.Alias.TransformService.XSLT http://www.w3.org/TR/1999/REC-xslt-19991116
 TransformService.http://www.w3.org/2000/09/xmldsig#enveloped-signature MechanismType DOM
-------------------------------------
-------------------------------------
name: SunPCSC
info: Sun PC/SC provider
version: 1.6
 Provider.id info Sun PC/SC provider
 Provider.id className sun.security.smartcardio.SunPCSC
 Provider.id version 1.6
 Provider.id name SunPCSC
 TerminalFactory.PC/SC sun.security.smartcardio.SunPCSC$Factory
-------------------------------------
-------------------------------------
name: SunMSCAPI
info: Sun's Microsoft Crypto API provider
version: 1.6
 SecureRandom.Windows-PRNG sun.security.mscapi.PRNG
 Provider.id version 1.6
 Cipher.RSA/ECB/PKCS1Padding sun.security.mscapi.RSACipher
 Signature.MD5withRSA SupportedKeyClasses sun.security.mscapi.Key
 KeyPairGenerator.RSA sun.security.mscapi.RSAKeyPairGenerator
 KeyStore.Windows-ROOT sun.security.mscapi.KeyStore$ROOT
 Signature.NONEwithRSA SupportedKeyClasses sun.security.mscapi.Key
 Cipher.RSA SupportedKeyClasses sun.security.mscapi.Key
 Signature.MD2withRSA sun.security.mscapi.RSASignature$MD2
 Signature.MD5withRSA sun.security.mscapi.RSASignature$MD5
 Cipher.RSA SupportedModes ECB
 Provider.id info Sun's Microsoft Crypto API provider
 Signature.SHA1withRSA SupportedKeyClasses sun.security.mscapi.Key
 Signature.SHA1withRSA sun.security.mscapi.RSASignature$SHA1
 Provider.id className sun.security.mscapi.SunMSCAPI
 KeyPairGenerator.RSA KeySize 1024
 Signature.MD2withRSA SupportedKeyClasses sun.security.mscapi.Key
 Provider.id name SunMSCAPI
 Cipher.RSA SupportedPaddings PKCS1PADDING
 Cipher.RSA sun.security.mscapi.RSACipher
 KeyStore.Windows-MY sun.security.mscapi.KeyStore$MY
-------------------------------------

 

 

 

이렇게 많ㅇ이 사용될 수 있는 알고리즘 구현방식이 있다.

 

 

아래 URL의 샘플 코드를 봐보자.

http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html

 

 

    import java.security.*;
   import javax.crypto.*;
   import javax.crypto.spec.*;
   import java.io.*;

   /**
   * This program generates a AES key, retrieves its raw bytes, and
   * then reinstantiates a AES key from the key bytes.
   * The reinstantiated key is used to initialize a AES cipher for
   * encryption and decryption.
   */

   public class AES {

     /**
     * Turns array of bytes into string
     *
     * @param buf Array of bytes to convert to hex string
     * @return Generated hex string
     */
     public static String asHex (byte buf[]) {
      StringBuffer strbuf = new StringBuffer(buf.length * 2);
      int i;

      for (i = 0; i < buf.length; i++) {
       if (((int) buf[i] & 0xff) < 0x10)
    strbuf.append("0");

       strbuf.append(Long.toString((int) buf[i] & 0xff, 16));
      }

      return strbuf.toString();
     }

     public static void main(String[] args) throws Exception {

       String message="This is just an example";

       // Get the KeyGenerator

       KeyGenerator kgen = KeyGenerator.getInstance("AES");
       kgen.init(128); // 192 and 256 bits may not be available


       // Generate the secret key specs.
       SecretKey skey = kgen.generateKey();
       byte[] raw = skey.getEncoded();

       SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");


       // Instantiate the cipher

       Cipher cipher = Cipher.getInstance("AES");

       cipher.init(Cipher.ENCRYPT_MODE, skeySpec);

       byte[] encrypted =
         cipher.doFinal((args.length == 0 ?
          "This is just an example" : args[0]).getBytes());
       System.out.println("encrypted string: " + asHex(encrypted));

       cipher.init(Cipher.DECRYPT_MODE, skeySpec);
       byte[] original =
         cipher.doFinal(encrypted);
       String originalString = new String(original);
       System.out.println("Original string: " +
         originalString + " " + asHex(original));
     }
   }

'java core' 카테고리의 다른 글

메모리 덤프 뜨기  (0) 2008.09.23
자바 튜닝 관련  (0) 2008.08.27
jdk 6 update 6 Release Notes  (0) 2008.05.30
자바 개발자라면 꼭 봐야할 것들  (0) 2008.05.21
org.apache.jasper.JasperException: Unable to compile class for JSP  (1) 2008.02.19
Posted by '김용환'
,