working on it ...

Filters

Explore Public Snippets

Sort by

Found 147 snippets matching: cryptography

    public by DavidEGrayson  351243  2  3  0

    Trying to install the cryptography pip in MSYS2 with mingw-w64-x86_64-python2-pip.

    Trying to install the cryptography pip in MSYS2 with mingw-w64-x86_64-python2-pip.: output.txt
    $ pip install -U cryptography
    Collecting cryptography
      Downloading cryptography-1.0.2.tar.gz (332kB)
    Collecting idna>=2.0 (from cryptography)
      Downloading idna-2.0-py2.py3-none-any.whl (61kB)
    Collecting pyasn1>=0.1.8 (from cryptography)
      Downloading pyasn1-0.1.9-py2.py3-none-any.whl
    Collecting six>=1.4.1 (from cryptography)
      Downloading six-1.10.0-py2.py3-none-any.whl
    Collecting setuptools (from cryptography)
      Downloading setuptools-18.4-py2.py3-none-any.whl (462kB)
    Collecting enum34 (from cryptography)
      Downloading enum34-1.0.4.tar.gz
    Collecting ipaddress (from cryptography)
      Downloading ipaddress-1.0.14-py27-none-any.whl
    Collecting cffi>=1.1.0 (from cryptography)
      Downloading cffi-1.2.1.tar.gz (335kB)
    Collecting pycparser (from cffi>=1.1.0->cryptography)
      Downloading pycparser-2.14.tar.gz (223kB)
    Installing collected packages: idna, pyasn1, six, setuptools, enum34, ipaddress, pycparser, cffi, cryptography
      Found existing installation: setuptools 18.3.2
        Uninstalling setuptools-18.3.2:
          Successfully uninstalled setuptools-18.3.2
      Running setup.py install for enum34
        Complete output from command D:/msys64/mingw64/bin/python2.exe -c "import setuptools, tokenize;__file__='c:/users/david/appdata/local/temp/pip-build-ojokdu/enum34/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\david\appdata\local\temp/pip-egkxlc-record/install-record.txt --single-version-externally-managed --compile:
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "D:/msys64/mingw64/lib/python2.7/site-packages/setuptools/__init__.py", line 12, in <module>
            from setuptools.extension import Extension
          File "D:/msys64/mingw64/lib/python2.7/site-packages/setuptools/extension.py", line 9, in <module>
            from . import msvc9_support
          File "D:/msys64/mingw64/lib/python2.7/site-packages/setuptools/msvc9_support.py", line 2, in <module>
            import distutils.msvc9compiler
          File "D:/msys64/mingw64/lib/python2.7/distutils/msvc9compiler.py", line 306, in <module>
            raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
        distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
    
        ----------------------------------------
    Command "D:/msys64/mingw64/bin/python2.exe -c "import setuptools, tokenize;__file__='c:/users/david/appdata/local/temp/pip-build-ojokdu/enum34/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\david\appdata\local\temp/pip-egkxlc-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:/users/david/appdata/local/temp/pip-build-ojokdu/enum34
    
    
    

    public by cghersi  290430  1  6  0

    How to simply compute the MD5 hash of a given string, being sure to have the same results retrieved by HASH method of MS SQL Server

    Returns the MD5 hash of the given string
    public static String computeMD5Hash(String input) {
    	if (isNullOrEmpty(input))
    		return "";
    	byte[] bytesOfMessage = null;
    	try {
    		bytesOfMessage = input.getBytes("UTF-16LE");
    	} catch (UnsupportedEncodingException e) {
    		log.error("Cannot support UTF-8 encoding due to " + e, e);
    		return "";
    	}
    	MessageDigest md = null;
    	try {
    		md = MessageDigest.getInstance("MD5");
    	} catch (NoSuchAlgorithmException e) {
    		log.error("Cannot support MD5 algorithm due to " + e, e);
    		return "";
    	}
    	byte[] thedigest = md.digest(bytesOfMessage);
    	return printHexByteArray(thedigest);
    }

    public by marksimon232  4690  7  7  8

    Efficient ModExp for Cryptographic purpose in C

    How to implement an efficient routine to calculate the Modular exponentiation as stated in http://en.wikipedia.org/wiki/Modular_exponentiation.
    Using modular multiplication rules:
    i.e. A^2 mod C = (A * A) mod C = ((A mod C) * (A mod C)) mod C
    We can use this to calculate 7^256 mod 13 quickly
    7^1 mod 13 = 7
    7^2 mod 13 = (7^1 *7^1) mod 13 = (7^1 mod 13 * 7^1 mod 13) mod 13
    We can substitute our previous result for 7^1 mod 13 into this equation.
    7^2 mod 13 = (7 *7) mod 13 = 49 mod 13 = 10
    7^2 mod 13 = 10
    7^4 mod 13 = (7^2 *7^2) mod 13 = (7^2 mod 13 * 7^2 mod 13) mod 13
    We can substitute our previous result for 7^2 mod 13 into this equation.
    7^4 mod 13 = (10 * 10) mod 13 = 100 mod 13 = 9
    7^4 mod 13 = 9
    7^8 mod 13 = (7^4 * 7^4) mod 13 = (7^4 mod 13 * 7^4 mod 13) mod 13
    We can substitute our previous result for 7^4 mod 13 into this equation.
    7^8 mod 13 = (9 * 9) mod 13 = 81 mod 13 = 3
    7^8 mod 13 = 3
    We continue in this manner, substituting previous results into our equations.
    ...after 5 iterations we hit:
    7^256 mod 13 = (7^128 * 7^128) mod 13 = (7^128 mod 13 * 7^128 mod 13) mod 13
    7^256 mod 13 = (3 * 3) mod 13 = 9 mod 13 = 9
    7^256 mod 13 = 9
    This has given us a method to calculate A^B mod C quickly provided that B is a power of 2.
    However, we also need a method for fast modular exponentiation when B is not a power of 
    
    Let say.. How can we calculate A^B mod C quickly for any B ?
    => Step 1: Divide B into powers of 2 by writing it in binary
    Start at the rightmost digit, let k=0 and for each digit:
    
    If the digit is 1, we need a part for 2^k, otherwise we do not
    Add 1 to k, and move left to the next digit
    
    => Step 2: Calculate mod C of the powers of two ≤ B
    5^1 mod 19 = 5
    5^2 mod 19 = (5^1 * 5^1) mod 19 = (5^1 mod 19 * 5^1 mod 19) mod 19
    5^2 mod 19 = (5 * 5) mod 19 = 25 mod 19
    5^2 mod 19 = 6
    5^4 mod 19 = (5^2 * 5^2) mod 19 = (5^2 mod 19 * 5^2 mod 19) mod 19
    5^4 mod 19 = (6 * 6) mod 19 = 36 mod 19
    5^4 mod 19 = 17
    5^8 mod 19 = (5^4 * 5^4) mod 19 = (5^4 mod 19 * 5^4 mod 19) mod 19
    5^8 mod 19 = (17 * 17) mod 19 = 289 mod 19
    5^8 mod 19 = 4
    5^16 mod 19 = (5^8 * 5^8) mod 19 = (5^8 mod 19 * 5^8 mod 19) mod 19
    5^16 mod 19 = (4 * 4) mod 19 = 16 mod 19
    5^16 mod 19 = 16
    5^32 mod 19 = (5^16 * 5^16) mod 19 = (5^16 mod 19 * 5^16 mod 19) mod 19
    5^32 mod 19 = (16 * 16) mod 19 = 256 mod 19
    5^32 mod 19 = 9
    5^64 mod 19 = (5^32 * 5^32) mod 19 = (5^32 mod 19 * 5^32 mod 19) mod 19
    5^64 mod 19 = (9 * 9) mod 19 = 81 mod 19
    5^64 mod 19 = 5
    
    => Step 3: Use modular multiplication properties to combine the calculated mod C values
    5^117 mod 19 = ( 5^1 * 5^4 * 5^16 * 5^32 * 5^64) mod 19
    5^117 mod 19 = ( 5^1 mod 19 * 5^4 mod 19 * 5^16 mod 19 * 5^32 mod 19 * 5^64 mod 19) mod 19
    5^117 mod 19 = ( 5 * 17 * 16 * 9 * 5 ) mod 19
    5^117 mod 19 = 61200 mod 19 = 1
    5^117 mod 19 = 1
    
    Notes:
    More optimization techniques exist, but are outside the scope of this snippet. It should be noted that when we perform modular exponentiation in cryptography, it is not unusual to use exponents for B > 1000 bits.
    

    public by DavidEGrayson  1924  0  3  0

    Python cryptography dependencies

    Python cryptography dependencies: py-crypto-deps.md
    [cryptography](https://pypi.python.org/pypi/cryptography)
    - idna >= 2.0
    - pyasn1 >= 0.1.8
    - [six](https://pypi.python.org/pypi/six) >= 1.4.1 - [mingw-packages](https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-python-six)
    - [setuptools](https://pypi.python.org/pypi/setuptools) - [mingw-packages](https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-python-setuptools)
    - [enum34](https://pypi.python.org/pypi/enum34)
    - ipaddress
    - cffi >= 1.1.0
      - Does not compile cleanly with MSYS2's pip
    
    

    public by Geometry  986  0  4  0

    HmacSha256

    Because Windows.Security.Cryptography.Core.MacAlgorithmNames.HmacSha256 doesn't exist in WP8.1 context we need to do another implementation
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Threading.Tasks;
    using Windows.Security.Cryptography;
    using Windows.Security.Cryptography.Core;
    using Windows.Web.Http;
    using Windows.Web.Http.Headers;
    
    // Because Windows.Security.Cryptography.Core.MacAlgorithmNames.HmacSha256 doesn't
    // exist in WP8.1 context we need to do another implementation
    public static string HmacSha256(string key, string value)
    {
        var keyStrm = CryptographicBuffer.ConvertStringToBinary(key, BinaryStringEncoding.Utf8);
        var valueStrm = CryptographicBuffer.ConvertStringToBinary(value, BinaryStringEncoding.Utf8);
    
        var objMacProv = MacAlgorithmProvider.OpenAlgorithm(MacAlgorithmNames.HmacSha256);
        var hash = objMacProv.CreateHash(keyStrm);
        hash.Append(valueStrm);
    
        return CryptographicBuffer.EncodeToBase64String(hash.GetValueAndReset());
    }

    public by msdn  1745  1  7  0

    GenerateAccessToken: Generates a serialized access token using the web token that is passed. Bearer {Header}.{Body}.Thumbprint All the 3 components are Base64 encoded individually. Since a lot of cryptography is performed...

    Generates a serialized access token using the web token that is passed. Bearer {Header}.{Body}.Thumbprint All the 3 components are Base64 encoded individually. Since a lot of cryptography is performed here, this function will be CPU intensive Json Web Security Token Signing certificate. OAuth bearer token (self-signed).
    /// <summary>
    /// Prefix for bearer tokens.
    /// </summary>
    private const string BearerTokenPrefix = "Bearer ";
    
    #region Not for sample app
    
    /// <summary>
    /// Generates a serialized access token using the web token that is passed.
    /// Bearer {Header}.{Body}.Thumbprint
    /// All the 3 components are Base64 encoded individually.
    /// Since a lot of cryptography is performed here, this function will be CPU intensive
    /// </summary>
    /// <param name="webToken">Json Web Security Token</param>
    /// <param name="signingCert">Signing certificate.</param>
    /// <returns>OAuth bearer token (self-signed).</returns>
    public static string GenerateAccessToken(
        JsonWebToken webToken, X509Certificate2 signingCert)
    {
        return String.Format(
            "{0}{1}",
            JWTTokenHelper.BearerTokenPrefix,
            JWTTokenHelper.GenerateAssertion(webToken, signingCert));
    }

    external by cedx  655172  75  4  0

    CRC32 checksum, in C#.

    CRC32 checksum, in C#.: security.cryptography.crc32.cs
    namespace Belin.Security.Cryptography {
      using System;
      using System.Globalization;
      using System.Security.Cryptography;
      
      /// <summary>Computes the CRC32 hash for the input data.</summary>
      [CLSCompliant(false)]
      public class Crc32: HashAlgorithm {
      
        /// <summary>Polynomial used to generate the checksum table.</summary>
        private const uint Polynomial=0xEDB88320;
        
        /// <summary>Seed used to generate the hash code.</summary>
        private const uint Seed=0xFFFFFFFF;
        
        /// <summary>Checksum table of 8-bit encoded values.</summary>
        private static readonly uint[] Table=InitializeTable(Polynomial);
        
        /// <summary>Computed hash code.</summary>
        private uint hash;
        
        /// <summary>Initializes a new instance of the <see cref="Crc32" /> class.</summary>
        public Crc32() {
          this.HashSizeValue=32;
          this.Initialize();
        }
    
        /// <summary>Initializes the instance.</summary>
        public override void Initialize() {
          this.hash=Seed;
        }
    
        /// <summary>Routes data written to the object into the hash algorithm for computing the hash.</summary>
        /// <param name="data">The input to compute the hash code for.</param>
        /// <param name="start">The offset into the byte array from which to begin using data.</param>
        /// <param name="size">The number of bytes in the byte array to use as data.</param>
        protected override void HashCore(byte[] data, int start, int size) {
          this.State=1;
          for(int i=start; i<size; i++) this.hash=(this.hash >> 8) ^ Table[data[i] ^ (this.hash & 0xFF)];
        }
    
        /// <summary>Finalizes the hash computation after the last data is processed by the cryptographic stream object.</summary>
        /// <returns>The computed hash code.</returns>
        protected override byte[] HashFinal() {
          this.HashValue=BitConverter.GetBytes(~this.hash);
          this.State=0;
          return this.HashValue;
        }
        
        /// <summary>Converts a byte array to a hexadecimal string.</summary>
        /// <param name="data">Data to convert.</param>
        /// <returns>Hexadecimal string corresponding to the specified data.</returns>
        public static string ToHex(byte[] data) {
          var builder=new StringBuilder();
          foreach(var item in data) builder.Append(item.ToString("x2", CultureInfo.InvariantCulture));
          return builder.ToString();
        }
    
        /// <summary>Converts a byte array to unsigned 32-bit integer.</summary>
        /// <remarks>The array passed as a parameter must have a maximum length of 4 elements.<remarks>
        /// <param name="data">Data to convert.</param>
        /// <returns>Unsigned 32-bit integer corresponding to the specified data.</returns>
        public static uint ToUInt32(byte[] data){
          return uint.Parse(ToHex(data), NumberStyles.HexNumber);
        }
    
        /// <summary>Initializes the checksum table from the specified polynomial.</summary>
        /// <param name="polynomial">Polynomial used to generate the checksum table.</param>
        /// <returns>Checksum table of 8-bit encoded values.</returns>
        private static uint[] InitializeTable(uint polynomial) {
          var table=new uint[256];
          
          for(int i=0; i<table.Length; i++) {
            var value=(uint) i;
            
            for(int j=0; j<8; j++) {
              if((value & 1)==1) value=(value>>1)^polynomial;
              else value>>=1;
            }
            
            table[i]=value;
          }
          
          return table;
        }
      }
    }
    
    
    

    external by dylan-ashley  125  0  2  0

    This is a simple cryptography library that has some basic encryption decryption functionality.

    This is a simple cryptography library that has some basic encryption decryption functionality.: cryptography.py
    #!/usr/bin/env python
    
    """
    This is a simple cryptography library that has some basic encryption
    decryption functionality.
    """
    
    # The MIT License (MIT)
    #
    # Copyright (c) 2016 Dylan Robert Ashley
    #
    # Permission is hereby granted, free of charge, to any person obtaining a copy
    # of this software and associated documentation files (the "Software"), to deal
    # in the Software without restriction, including without limitation the rights
    # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    # copies of the Software, and to permit persons to whom the Software is
    # furnished to do so, subject to the following conditions:
    #
    # The above copyright notice and this permission notice shall be included in
    # all copies or substantial portions of the Software.
    #
    # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    # THE SOFTWARE.
    
    import string
    
    
    def to_number(letter):
        """
        Converts letter into its corresponding number in the alphabet.
    
        >>> to_number("a")
        0
        >>> to_number("Z")
        25
        """
        if letter.islower():
            return string.ascii_lowercase.index(letter)
        elif letter.isupper():
            return string.ascii_uppercase.index(letter)
        else:
            raise TypeError("argument not an ascii letter")
    
    
    def to_letter(number):
        """
        Converts number into its corresponding lowercase letter in the
        alphabet.
    
        >>> to_letter(0)
        'a'
        >>> to_letter(25)
        'z'
        """
        if number < 0 or number > 25:
            raise IndexError("number out of range")
        else:
            return string.ascii_lowercase[number]
    
    
    def to_letters(text, keep_whitespace=False):
        """
        Converts a string into a list containing all of the letters
        contained in the original string.
    
        If keep_whitespace is true then preserves whitespace characters.
    
        >>> to_letters("Hello World!")
        ['H', 'e', 'l', 'l', 'o', 'W', 'o', 'r', 'l', 'd']
        >>> to_letters("Hello World!", keep_whitespace=True)
        ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd']
        >>> to_letters("")
        []
        """
        return [letter for letter in text if letter.isalpha() or
                keep_whitespace and letter.isspace()]
    
    
    def inc_letter(letter, value):
        """
        Returns the letter appearing value letters later in the alphabet.
    
        >>> inc_letter("a", 1)
        'b'
        >>> inc_letter("z", -25)
        'a'
        """
        rv = to_letter((to_number(letter) + value) % 26)
        return rv.upper() if letter.isupper() else rv
    
    
    def _ceasar(text, value):
        """
        Returns the text with every letter shifted to the letter appearing
        value letters after it in the alphabet.
    
        >>> _ceasar("Hello World!", 1)
        'Ifmmp Xpsme!'
        >>> _ceasar("Ifmmp Xpsme!", -1)
        'Hello World!'
        """
        return "".join([inc_letter(letter, value) if letter.isalpha() else letter
                        for letter in text])
    
    
    def encrypt_ceasar(text, value=13):
        """
        Returns the text with every letter shifted to the letter appearing
        value letters after it in the alphabet.
    
        >>> encrypt_ceasar("Hello World!", 1)
        'Ifmmp Xpsme!'
        >>> encrypt_ceasar(encrypt_ceasar("Hello World!"))
        'Hello World!'
        """
        return _ceasar(text, value)
    
    
    def decrypt_ceasar(text, value=13):
        """
        Returns the text with every letter shifted to the letter appearing
        value letters before it in the alphabet.
    
        >>> decrypt_ceasar("Ifmmp Xpsme!", 1)
        'Hello World!'
        >>> decrypt_ceasar(decrypt_ceasar("Hello World!"))
        'Hello World!'
        """
        return _ceasar(text, -value)
    
    
    def all_ceasar(text):
        """
        Returns a list with all the combinations of plaintext text could
        have been encoded with a simple generalized ceasar cipher.
    
        >>> "".join(all_ceasar("a"))
        'zyxwvutsrqponmlkjihgfedcb'
        """
        return [decrypt_ceasar(text, value=i) for i in range(1, 26)]
    
    
    def frequency(text):
        """
        Returns a dictionary with each letter and the count of that letter
        in the text.
    
        Non-alphabetical characters in word are ignored.
    
        >>> frequency("aAaAa")
        {'a': 5}
        >>> "!" in frequency("Hello World!")
        False
        """
        counts = dict()
        for letter in to_letters(text):
            letter = letter.lower()
            if letter in counts:
                counts[letter] += 1
            else:
                counts[letter] = 1
        return counts
    
    
    def polyalphabetic_encrypt(text, word):
        """
        Encrypts text with a polyalphabetic cipher using word as the key.
    
        Non-alphabetical characters in word are ignored.
    
        >>> polyalphabetic_encrypt("Student", "HAM")
        'Ztgkeza'
        >>> polyalphabetic_encrypt("Hello World!", "b")
        'Ifmmp Xpsme!'
        """
        word = to_letters(word)
        text = list(text)
    
        for i in range(len(text)):
            if text[i].isalpha():
                text[i] = inc_letter(text[i], to_number(word[i % len(word)]))
        return "".join(text)
    
    
    def polyalphabetic_decrypt(text, word):
        """
        Decrypts text encoded with a polyalphabetic cipher using word as
        the key.
    
        Non-alphabetical characters in word are ignored.
    
        >>> polyalphabetic_decrypt("Ztgkeza", "HAM")
        'Student'
        >>> polyalphabetic_decrypt("Ifmmp Xpsme!", "b")
        'Hello World!'
        """
        word = to_letters(word)
        text = list(text)
    
        for i in range(len(text)):
            if text[i].isalpha():
                text[i] = inc_letter(text[i], 26 - to_number(word[i % len(word)]))
        return "".join(text)
    
    
    def linear_encrypt(text, a, k):
        """
        Encrypts text using the linear encryption formula
        E(x) = (ax + k) % 26.
    
        >>> linear_encrypt("This", 5, 5)
        'Wotr'
        """
        text = list(text)
    
        for i in range(len(text)):
            if text[i].isalpha():
                letter = to_letter((a * to_number(text[i]) + k) % 26)
                text[i] = letter.upper() if text[i].isupper() else letter
        return "".join(text)
    
    
    def linear_decrypt(text, a, k):
        """
        Decrypts text using the decryption formula
        D(x) = a ^ -1 (x + k) % 26, where a ^ -1 is the multiplicative
        inverse of a in mod 26.
    
        >>> linear_decrypt("Wotr", 5, 5)
        'This'
        """
        for i in range(26):
            if a * i % 26 == 1:
                a = i
                break
        else:
            raise ValueError("a is not relatively prime in mod 26")
    
        text = list(text)
    
        for i in range(len(text)):
            if text[i].isalpha():
                letter = to_letter(a * (to_number(text[i]) - k) % 26)
                text[i] = letter.upper() if text[i].isupper() else letter
        return "".join(text)
    
    
    if __name__ == "__main__":
        import doctest
        doctest.testmod()
    
    
    

    external by Github  80  0  1  0

    Go travelling <a href=" http://prettytall.com/sitemap6.html ">levitra prescriptions online</a> A NIST official told Reuters that the agency would workclosely with outside cryptography experts to see whether otherstandards were problematic. "We are loo...

    Go travelling levitra prescriptions online A NIST official told Reuters that the agency would workclosely with outside cryptography experts to see whether otherstandards were problematic. "We are looking at reviewing ourprocesses," said Donna Dodson, deputy cybersecurity advisor atNIST. : Behappy
    Go travelling <a href=" http://prettytall.com/sitemap6.html ">levitra prescriptions online</a>  A NIST official told Reuters that the agency would workclosely with outside cryptography experts to see whether otherstandards were problematic. "We are looking at reviewing ourprocesses," said Donna Dodson, deputy cybersecurity advisor atNIST.
     
    
    

    external by Michael Floering  79  0  1  0

    install Java Cryptography Extensions (unlimited JCE)

    install Java Cryptography Extensions (unlimited JCE): install_jce_policy_jars.sh
    # ABOUT:        https://en.wikipedia.org/wiki/Java_Cryptography_Extension
    # AUTHOR:       gist.github.com/hangtwenty
    # PREREQUISITE:
    #   Download jce_policy*.zip from Oracle:
    #   - Java 8: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
    #   - Java 7: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
    
    unzip $HOME/Downloads/jce_policy*.zip -d $HOME/Downloads/jce_policy_jars
    jre_path="$JAVA_HOME/jre"
    dest="$jre_path/lib/security"
    if [ ! -d "$dest" ] ; then
      echo "$dest is supposed to exist and be a directory"
      exit 127
    fi
    for jar in $( find $HOME/Downloads/jce_policy_jars/ -name '*.jar' );
      do echo "[.] installing $jar into $dest"
      sudo cp $jar $dest
    done
    
    
    • Public Snippets
    • Channels Snippets