If an application is considered "exempt" if an exemption mechanism is enforced, then the permission policy file that accompanies the application must specify one or more exemption mechanisms. At runtime, the application will be considered exempt if any of those exemption mechanisms is enforced. Each exemption mechanism must be specified in a permission entry that looks like the following:
// No algorithm restrictions if specified // exemption mechanism is enforced. permission javax.crypto.CryptoPermission *, "<ExemptionMechanismName>";
where <ExemptionMechanismName>
specifies the
name of an exemption mechanism. The list of possible exemption
mechanism names includes:
grant { // No algorithm restrictions if KeyRecovery is enforced. permission javax.crypto.CryptoPermission *, "KeyRecovery"; // No algorithm restrictions if KeyEscrow is enforced. permission javax.crypto.CryptoPermission *, "KeyEscrow"; };
NOTE: Permission entries that specify exemption mechanisms should not also specify maximum key sizes. The allowed key sizes are actually determined from the installed exempt jurisdiction policy files, as described in the next section.
At runtime, when an application instantiates a Cipher (via a
call to its getInstance
method) and that application
has an associated permission policy file, JCA checks to see whether
the permission policy file has an entry that applies to the
algorithm specified in the getInstance
call. If it
does, and the entry grants CryptoAllPermission or does not specify
that an exemption mechanism must be enforced, it means there is no
cryptographic restriction for this particular algorithm.
If the permission policy file has an entry that applies to the
algorithm specified in the getInstance
call and the
entry does specify that an exemption mechanism must be
enforced, then the exempt jurisdiction policy file(s) are examined.
If the exempt permissions include an entry for the relevant
algorithm and exemption mechanism, and that entry is implied by the
permissions in the permission policy file bundled with the
application, and if there is an implementation of the specified
exemption mechanism available from one of the registered providers,
then the maximum key size and algorithm parameter values for the
Cipher are determined from the exempt permission entry.
If there is no exempt permission entry implied by the relevant entry in the permission policy file bundled with the application, or if there is no implementation of the specified exemption mechanism available from any of the registered providers, then the application is only allowed the standard default cryptographic permissions.
Here are some short examples which illustrate use of several of the JCA mechanisms. In addition, complete working examples can be found in Appendix D.
MessageDigest
ObjectFirst create the message digest object, as in the following example:
MessageDigest sha = MessageDigest.getInstance("SHA-1");This call assigns a properly initialized message digest object to the
sha
variable. The implementation implements the
Secure Hash Algorithm (SHA-1), as defined in the National Institute
for Standards and Technology's (NIST) FIPS 180-2
document. See Appendix A for a complete
discussion of standard names and algorithms.
Next, suppose we have three byte arrays, i1
,
i2
and i3
, which form the total input
whose message digest we want to compute. This digest (or "hash")
could be calculated via the following calls:
sha.update(i1); sha.update(i2); sha.update(i3); byte[] hash = sha.digest();
An equivalent alternative series of calls would be:
sha.update(i1); sha.update(i2); byte[] hash = sha.digest(i3);After the message digest has been calculated, the message digest object is automatically reset and ready to receive new data and calculate its digest. All former state (i.e., the data supplied to
update
calls) is lost.
Some hash implementations may support intermediate hashes through cloning. Suppose we want to calculate separate hashes for:
i1
i1 and i2
i1, i2, and i3
A way to do it is:
/* compute the hash for i1 */ sha.update(i1); byte[] i1Hash = sha.clone().digest(); /* compute the hash for i1 and i2 */ sha.update(i2); byte[] i12Hash = sha.clone().digest(); /* compute the hash for i1, i2 and i3 */ sha.update(i3); byte[] i123hash = sha.digest();This code works only if the SHA-1 implementation is cloneable. While some implementations of message digests are cloneable, others are not. To determine whether or not cloning is possible, attempt to clone the
MessageDigest
object and catch the
potential exception as follows:
try { // try and clone it /* compute the hash for i1 */ sha.update(i1); byte[] i1Hash = sha.clone().digest(); // ... byte[] i123hash = sha.digest(); } catch (CloneNotSupportedException cnse) { // do something else, such as the code shown below }If a message digest is not cloneable, the other, less elegant way to compute intermediate digests is to create several digests. In this case, the number of intermediate digests to be computed must be known in advance:
MessageDigest
sha1 = MessageDigest.getInstance("SHA-1");MessageDigest
sha12 = MessageDigest.getInstance("SHA-1");MessageDigest
sha123 = MessageDigest.getInstance("SHA-1"); byte[] i1Hash = sha1.digest(i1); sha12.update(i1); byte[] i12Hash = sha12.digest(i2); sha123.update(i1); sha123.update(i2); byte[] i123Hash = sha123.digest(i3);
In this example we will generate a public-private key pair for the algorithm named "DSA" (Digital Signature Algorithm), and use this keypair in future examples. We will generate keys with a 1024-bit modulus. We don't care which provider supplies the algorithm implementation.
The first step is to get a key pair generator object for generating keys for the DSA algorithm:
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA");
The next step is to initialize the key pair generator. In most cases, algorithm-independent initialization is sufficient, but in some cases, algorithm-specific initialization is used.
All key pair generators share the concepts of a keysize and a
source of randomness. The KeyPairGenerator
class
initialization methods at a minimum needs a keysize. If the source
of randomness is not explicitly provided, a
SecureRandom
implementation of the highest-priority
installed provider will be used. Thus to generate keys with a
keysize of 1024, simply call:
SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN"); keyGen.initialize(1024, random);The following code illustrates how to use a specific, additionally seeded
SecureRandom
object:
SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN"); random.setSeed(userSeed); keyGen.initialize(1024, random);Since no other parameters are specified when you call the above algorithm-independent
initialize
method, it is up to
the provider what to do about the algorithm-specific parameters (if
any) to be associated with each of the keys. The provider may use
precomputed parameter values or may generate new values.
For situations where a set of algorithm-specific parameters
already exists (such as "community parameters" in DSA), there are
two initialize
methods that have an AlgorithmParameterSpec
argument. Suppose your key pair generator is for the "DSA"
algorithm, and you have a set of DSA-specific parameters,
p
, q
, and g
, that you would
like to use to generate your key pair. You could execute the
following code to initialize your key pair generator (recall that
DSAParameterSpec
is an AlgorithmParameterSpec):
DSAParameterSpec dsaSpec = new DSAParameterSpec(p, q, g); SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN"); random.setSeed(userSeed); keyGen.initialize(dsaSpec, random);
p
is a prime
number whose length is the modulus length ("size"). Therefore, you
don't need to call any other method to specify the modulus
length.The final step is actually generating the key pair. No matter which type of initialization was used (algorithm-independent or algorithm-specific), the same code is used to generate the key pair:
KeyPair pair = keyGen.generateKeyPair();
The following signature generation and verification examples use
the KeyPair
generated in the key pair
example above.
We first create a signature object:
Signature dsa = Signature.getInstance("SHA1withDSA");
Next, using the key pair generated in the key pair example, we
initialize the object with the private key, then sign a byte array
called data
.
/* Initializing the object with a private key */ PrivateKey priv = pair.getPrivate(); dsa.initSign(priv); /* Update and sign the data */ dsa.update(data); byte[] sig = dsa.sign();
Verifying the signature is straightforward. (Note that here we also use the key pair generated in the key pair example.)
/* Initializing the object with the public key */ PublicKey pub = pair.getPublic(); dsa.initVerify(pub); /* Update and verify the data */ dsa.update(data); boolean verifies = dsa.verify(sig); System.out.println("signature verifies: " + verifies);
KeyFactory
Suppose that, rather than having a public/private key pair (as,
for example, was generated in the key pair
example above), you simply have the components of your DSA
private key: x
(the private key), p
(the
prime), q
(the sub-prime), and g
(the
base).
Further suppose you want to use your private key to digitally
sign some data, which is in a byte array named
someData
. You would do the following steps, which also
illustrate creating a key specification and using a key factory to
obtain a PrivateKey
from the key specification
(initSign
requires a PrivateKey
):
DSAPrivateKeySpec dsaPrivKeySpec = new DSAPrivateKeySpec(x, p, q, g); KeyFactory keyFactory = KeyFactory.getInstance("DSA"); PrivateKey privKey = keyFactory.generatePrivate(dsaPrivKeySpec); Signature sig = Signature.getInstance("SHA1withDSA"); sig.initSign(privKey); sig.update(someData); byte[] signature = sig.sign();
Suppose Alice wants to use the data you signed. In order for her to do so, and to verify your signature, you need to send her three things:
You can store the someData
bytes in one file, and
the signature
bytes in another, and send those to
Alice.
For the public key, assume, as in the signing example above, you
have the components of the DSA public key corresponding to the DSA
private key used to sign the data. Then you can create a
DSAPublicKeySpec
from those components:
DSAPublicKeySpec dsaPubKeySpec = new DSAPublicKeySpec(y, p, q, g);
You still need to extract the key bytes so that you can put them
in a file. To do so, you can first call the
generatePublic
method on the DSA key factory already
created in the example above:
PublicKey pubKey = keyFactory.generatePublic(dsaPubKeySpec);Then you can extract the (encoded) key bytes via the following:
byte[] encKey = pubKey.getEncoded();
You can now store these bytes in a file, and send it to Alice along with the files containing the data and the signature.
Now, assume Alice has received these files, and she copied the
data bytes from the data file to a byte array named
data
, the signature bytes from the signature file to a
byte array named signature
, and the encoded public key
bytes from the public key file to a byte array named
encodedPubKey
.
Alice can now execute the following code to verify the
signature. The code also illustrates how to use a key factory in
order to instantiate a DSA public key from its encoding
(initVerify
requires a PublicKey
).
X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(encodedPubKey); KeyFactory keyFactory = KeyFactory.getInstance("DSA"); PublicKey pubKey = keyFactory.generatePublic(pubKeySpec); Signature sig = Signature.getInstance("SHA1withDSA"); sig.initVerify(pubKey); sig.update(data); sig.verify(signature);NOTE: In the above, Alice needed to generate a
PublicKey
from the encoded key bits, since
initVerify
requires a PublicKey
. Once she
has a PublicKey
, she could also use the
KeyFactory
getKeySpec
method to convert
it to a DSAPublicKeySpec
so that she can access the
components, if desired, as in:
DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keyFactory.getKeySpec(pubKey, DSAPublicKeySpec.class)
Now she can access the DSA public key components y
,
p
, q
, and g
through the
corresponding "get" methods on the DSAPublicKeySpec
class (getY
, getP
, getQ
, and
getG
).
In many cases you would like to know if two keys are equal;
however, the default method java.lang.Object.equals
may not give the desired result. The most provider-independent
approach is to compare the encoded keys. If this comparison isn't
appropriate (for example, when comparing an
RSAPrivateKey
and an RSAPrivateCrtKey
),
you should compare each component. The following code demonstrates
this idea:
static boolean keysEqual(Key key1, Key key2) { if (key1.equals(key2)) { return true; } if (Arrays.equals(key1.getEncoded(), key2.getEncoded())) { return true; } // More code for different types of keys here. // For example, the following code can check if // an RSAPrivateKey and an RSAPrivateCrtKey are equal: // if ((key1 instanceof RSAPrivateKey) && // (key2 instanceof RSAPrivateKey)) { // if ((key1.getModulus().equals(key2.getModulus())) && // (key1.getPrivateExponent().equals( // key2.getPrivateExponent()))) { // return true; // } // } return false; }
The following example reads a file with Base64-encoded certificates, which are each bounded at the beginning by
-----BEGIN CERTIFICATE-----and at the end by
-----END CERTIFICATE-----We convert the
FileInputStream
(which does not support
mark
and reset
) to a
ByteArrayInputStream
(which supports those methods),
so that each call to generateCertificate
consumes only
one certificate, and the read position of the input stream is
positioned to the next certificate in the file:
FileInputStream fis = new FileInputStream(filename); BufferedInputStream bis = new BufferedInputStream(fis); CertificateFactory cf = CertificateFactory.getInstance("X.509"); while (bis.available() > 0) { Certificate cert = cf.generateCertificate(bis); System.out.println(cert.toString()); }
The following example parses a PKCS7-formatted certificate reply stored in a file and extracts all the certificates from it:
FileInputStream fis = new FileInputStream(filename); CertificateFactory cf = CertificateFactory.getInstance("X.509"); Collection c = cf.generateCertificates(fis); Iterator i = c.iterator(); while (i.hasNext()) { Certificate cert = (Certificate)i.next(); System.out.println(cert); }
This section takes the user through the process of generating a key, creating and initializing a cipher object, encrypting a file, and then decrypting it. Throughout this example, we use the Advanced Encryption Standard (AES).
To create an AES key, we have to instantiate a KeyGenerator for AES. We do not specify a provider, because we do not care about a particular AES key generation implementation. Since we do not initialize the KeyGenerator, a system-provided source of randomness and a default keysize will be used to create the AES key:
KeyGenerator keygen = KeyGenerator.getInstance("AES"); SecretKey aesKey = keygen.generateKey();
After the key has been generated, the same KeyGenerator object can be re-used to create further keys.
The next step is to create a Cipher instance. To do this, we use
one of the getInstance
factory methods of the Cipher
class. We must specify the name of the requested transformation,
which includes the following components, separated by slashes
(/):
In this example, we create an AES cipher in Electronic Codebook mode, with PKCS5-style padding. We do not specify a provider, because we do not care about a particular implementation of the requested transformation.
The standard algorithm name for AES is "AES", the standard name for the Electronic Codebook mode is "ECB", and the standard name for PKCS5-style padding is "PKCS5Padding":
Cipher aesCipher; // Create the cipher aesCipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
We use the generated aesKey
from above to
initialize the Cipher object for encryption:
// Initialize the cipher for encryption aesCipher.init(Cipher.ENCRYPT_MODE, aesKey); // Our cleartext byte[] cleartext = "This is just an example".getBytes(); // Encrypt the cleartext byte[] ciphertext = aesCipher.doFinal(cleartext); // Initialize the same cipher for decryption aesCipher.init(Cipher.DECRYPT_MODE, aesKey); // Decrypt the ciphertext byte[] cleartext1 = aesCipher.doFinal(ciphertext);
cleartext
and cleartext1
are
identical.
In this example, we prompt the user for a password from which we derive an encryption key.
It would seem logical to collect and store the password in an
object of type java.lang.String
. However, here's the
caveat: Objects of type String
are immutable, i.e.,
there are no methods defined that allow you to change (overwrite)
or zero out the contents of a String
after usage. This
feature makes String
objects unsuitable for storing
security sensitive information such as user passwords. You should
always collect and store security sensitive information in a char
array instead.
For that reason, the javax.crypto.spec.PBEKeySpec
class takes (and returns) a password as a char array. See the
ReadPassword class in the sample code
in Appendix D for one possible way of reading
character array passwords from an input stream.
In order to use Password-Based Encryption (PBE) as defined in PKCS5, we have to specify a salt and an iteration count. The same salt and iteration count that are used for encryption must be used for decryption. Newer PBE algorithms use an iteration count of atleast 1000.
PBEKeySpec pbeKeySpec; PBEParameterSpec pbeParamSpec; SecretKeyFactory keyFac; // Salt byte[] salt = { (byte)0xc7, (byte)0x73, (byte)0x21, (byte)0x8c, (byte)0x7e, (byte)0xc8, (byte)0xee, (byte)0x99 }; // Iteration count int count = 1000; // Create PBE parameter set pbeParamSpec = new PBEParameterSpec(salt, count); // Prompt user for encryption password. // Collect user password as char array (using the // "readPassword" method from above), and convert // it into a SecretKey object, using a PBE key // factory. System.out.print("Enter encryption password: "); System.out.flush(); pbeKeySpec = new PBEKeySpec(readPassword(System.in)); keyFac = SecretKeyFactory.getInstance("PBEWithHmacSHA256AndAES_256"); SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec); // Create PBE Cipher Cipher pbeCipher = Cipher.getInstance("PBEWithHmacSHA256AndAES_256"); // Initialize PBE Cipher with key and parameters pbeCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec); // Our cleartext byte[] cleartext = "This is another example".getBytes(); // Encrypt the cleartext byte[] ciphertext = pbeCipher.doFinal(cleartext);
Please refer to Appendix D for sample programs exercising the Diffie-Hellman key exchange between 2 and 3 parties.
The JDK Security API requires and uses a set of standard names for algorithms, certificate and keystore types. The specification names previously found here in Appendix A and in the other security specifications (JSSE/CertPath/etc.) have been combined in the Standard Names document. This document also contains more information about the algorithm specifications. Specific provider information can be found in the Sun Provider Documentation.
Cryptographic implementations in the JDK are distributed through
several different providers primarily for historical reasons
(Sun
, SunJSSE
, SunJCE
,
SunRsaSign
). Note these providers may not be available
on all JDK implementations, and therefore, truly portable
applications should call getInstance()
without
specifying specific providers. Applications specifying a particular
provider may not be able to take advantage of native providers
tuned for an underlying operating environment (such as PKCS or
Microsoft's CAPI).
The SunPKCS11
provider itself does not contain any
cryptographic algorithms, but instead, directs requests into an
underlying PKCS11 implementation. The PKCS11 Reference Guide and the underlying
PKCS11 implementation should be consulted to determine if a desired
algorithm will be available through the PKCS11 provider. Likewise,
on Windows systems, the SunMSCAPI
provider does not
provide any cryptographic functionality, but instead routes
requests to the underlying Operating System for handling.
JCA represents its jurisdiction policy files as Java style policy files with corresponding permission statements. As described in Default Policy Implementation and Policy File Syntax, a Java policy file specifies what permissions are allowed for code from specified code sources. A permission represents access to a system resource. In the case of JCA, the "resources" are cryptography algorithms, and code sources do not need to be specified, because the cryptographic restrictions apply to all code.
A jurisdiction policy file consists of a very basic "grant entry" containing one or more "permission entries."
grant {
<permission entries>;
};
The format of a permission entry in a jurisdiction policy file is:
permission <crypto permission class name>[ <alg_name> [[, <exemption mechanism name>][, <maxKeySize> [, <AlgorithmParameterSpec class name>, <parameters for constructing an AlgorithmParameterSpec object>]]]];
A sample jurisdiction policy file that includes restricting the "Blowfish" algorithm to maximum key sizes of 64 bits is:
grant { permission javax.crypto.CryptoPermission "Blowfish", 64; // ... };
A permission entry must begin with the word
permission
. The <crypto permission class
name>
in the template above would actually be a specific
permission class name, such as
javax.crypto.CryptoPermission
. A crypto permission
class reflects the ability of an application/applet to use certain
algorithms with certain key sizes in certain environments. There
are two crypto permission classes: CryptoPermission
and CryptoAllPermission
. The special
CryptoAllPermission
class implies all
cryptography-related permissions, that is, it specifies that there
are no cryptography-related restrictions.
The <alg_name>, when utilized, is a quoted string specifying the standard name (see Appendix A) of a cryptography algorithm, such as "DES" or "RSA".
The <exemption mechanism name>, when specified, is a quoted string indicating an exemption mechanism which, if enforced, enables a reduction in cryptographic restrictions. Exemption mechanism names that can be used include "KeyRecovery" "KeyEscrow", and "KeyWeakening".
<maxKeySize> is an integer specifying the maximum key size (in bits) allowed for the specified algorithm.
For some algorithms it may not be sufficient to specify the
algorithm strength in terms of just a key size. For example, in the
case of the "RC5" algorithm, the number of rounds must also be
considered. For algorithms whose strength needs to be expressed as
more than a key size, the permission entry should also specify an
AlgorithmParameterSpec class name (such as
javax.crypto.spec.RC5ParameterSpec
) and a list of
parameters for constructing the specified AlgorithmParameterSpec
object.
Items that appear in a permission entry must appear in the specified order. An entry is terminated with a semicolon.
Case is unimportant for the identifiers (grant
,
permission
) but is significant for the
<crypto permission class name>
or for any string
that is passed in as a value.
NOTE: An "*" can be used as a wildcard for any permission entry option. For example, an "*" (without the quotes) for an <alg_name> option means "all algorithms."
Due to import control restrictions, the jurisdiction policy files shipped with the Java SE Development Kit allow "strong" but limited cryptography to be used. For more info, please see Import Limits on Cryptographic Algorithms.
/* * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Oracle nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.spec.*; import java.security.interfaces.*; import javax.crypto.*; import javax.crypto.spec.*; import javax.crypto.interfaces.*; import com.sun.crypto.provider.SunJCE; /** * This program executes the Diffie-Hellman key agreement protocol * between 2 parties: Alice and Bob. * * By default, preconfigured parameters (1024-bit prime modulus and base * generator used by SKIP) are used. * If this program is called with the "-gen" option, a new set of * parameters is created. */ public class DHKeyAgreement2 { private DHKeyAgreement2() {} public static void main(String argv[]) { try { String mode = "USE_SKIP_DH_PARAMS"; DHKeyAgreement2 keyAgree = new DHKeyAgreement2(); if (argv.length > 1) { keyAgree.usage(); throw new Exception("Wrong number of command options"); } else if (argv.length == 1) { if (!(argv[0].equals("-gen"))) { keyAgree.usage(); throw new Exception("Unrecognized flag: " + argv[0]); } mode = "GENERATE_DH_PARAMS"; } keyAgree.run(mode); } catch (Exception e) { System.err.println("Error: " + e); System.exit(1); } } private void run(String mode) throws Exception { DHParameterSpec dhSkipParamSpec; if (mode.equals("GENERATE_DH_PARAMS")) { // Some central authority creates new DH parameters System.out.println ("Creating Diffie-Hellman parameters (takes VERY long) ..."); AlgorithmParameterGenerator paramGen = AlgorithmParameterGenerator.getInstance("DH"); paramGen.init(512); AlgorithmParameters params = paramGen.generateParameters(); dhSkipParamSpec = (DHParameterSpec)params.getParameterSpec (DHParameterSpec.class); } else { // use some pre-generated, default DH parameters System.out.println("Using SKIP Diffie-Hellman parameters"); dhSkipParamSpec = new DHParameterSpec(skip1024Modulus, skip1024Base); } /* * Alice creates her own DH key pair, using the DH parameters from * above */ System.out.println("ALICE: Generate DH keypair ..."); KeyPairGenerator aliceKpairGen = KeyPairGenerator.getInstance("DH"); aliceKpairGen.initialize(dhSkipParamSpec); KeyPair aliceKpair = aliceKpairGen.generateKeyPair(); // Alice creates and initializes her DH KeyAgreement object System.out.println("ALICE: Initialization ..."); KeyAgreement aliceKeyAgree = KeyAgreement.getInstance("DH"); aliceKeyAgree.init(aliceKpair.getPrivate()); // Alice encodes her public key, and sends it over to Bob. byte[] alicePubKeyEnc = aliceKpair.getPublic().getEncoded(); /* * Let's turn over to Bob. Bob has received Alice's public key * in encoded format. * He instantiates a DH public key from the encoded key material. */ KeyFactory bobKeyFac = KeyFactory.getInstance("DH"); X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec (alicePubKeyEnc); PublicKey alicePubKey = bobKeyFac.generatePublic(x509KeySpec); /* * Bob gets the DH parameters associated with Alice's public key. * He must use the same parameters when he generates his own key * pair. */ DHParameterSpec dhParamSpec = ((DHPublicKey)alicePubKey).getParams(); // Bob creates his own DH key pair System.out.println("BOB: Generate DH keypair ..."); KeyPairGenerator bobKpairGen = KeyPairGenerator.getInstance("DH"); bobKpairGen.initialize(dhParamSpec); KeyPair bobKpair = bobKpairGen.generateKeyPair(); // Bob creates and initializes his DH KeyAgreement object System.out.println("BOB: Initialization ..."); KeyAgreement bobKeyAgree = KeyAgreement.getInstance("DH"); bobKeyAgree.init(bobKpair.getPrivate()); // Bob encodes his public key, and sends it over to Alice. byte[] bobPubKeyEnc = bobKpair.getPublic().getEncoded(); /* * Alice uses Bob's public key for the first (and only) phase * of her version of the DH * protocol. * Before she can do so, she has to instantiate a DH public key * from Bob's encoded key material. */ KeyFactory aliceKeyFac = KeyFactory.getInstance("DH"); x509KeySpec = new X509EncodedKeySpec(bobPubKeyEnc); PublicKey bobPubKey = aliceKeyFac.generatePublic(x509KeySpec); System.out.println("ALICE: Execute PHASE1 ..."); aliceKeyAgree.doPhase(bobPubKey, true); /* * Bob uses Alice's public key for the first (and only) phase * of his version of the DH * protocol. */ System.out.println("BOB: Execute PHASE1 ..."); bobKeyAgree.doPhase(alicePubKey, true); /* * At this stage, both Alice and Bob have completed the DH key * agreement protocol. * Both generate the (same) shared secret. */ byte[] aliceSharedSecret = aliceKeyAgree.generateSecret(); int aliceLen = aliceSharedSecret.length; byte[] bobSharedSecret = new byte[aliceLen]; int bobLen; try { // show example of what happens if you // provide an output buffer that is too short bobLen = bobKeyAgree.generateSecret(bobSharedSecret, 1); } catch (ShortBufferException e) { System.out.println(e.getMessage()); } // provide output buffer of required size bobLen = bobKeyAgree.generateSecret(bobSharedSecret, 0); System.out.println("Alice secret: " + toHexString(aliceSharedSecret)); System.out.println("Bob secret: " + toHexString(bobSharedSecret)); if (!java.util.Arrays.equals(aliceSharedSecret, bobSharedSecret)) throw new Exception("Shared secrets differ"); System.out.println("Shared secrets are the same"); /* * Now let's return the shared secret as a SecretKey object * and use it for encryption. First, we generate SecretKeys for the * "DES" algorithm (based on the raw shared secret data) and * then we use DES in ECB mode * as the encryption algorithm. DES in ECB mode does not require any * parameters. * * Then we use DES in CBC mode, which requires an initialization * vector (IV) parameter. In CBC mode, you need to initialize the * Cipher object with an IV, which can be supplied using the * javax.crypto.spec.IvParameterSpec class. Note that you have to use * the same IV for encryption and decryption: If you use a different * IV for decryption than you used for encryption, decryption will * fail. * * NOTE: If you do not specify an IV when you initialize the * Cipher object for encryption, the underlying implementation * will generate a random one, which you have to retrieve using the * javax.crypto.Cipher.getParameters() method, which returns an * instance of java.security.AlgorithmParameters. You need to transfer * the contents of that object (e.g., in encoded format, obtained via * the AlgorithmParameters.getEncoded() method) to the party who will * do the decryption. When initializing the Cipher for decryption, * the (reinstantiated) AlgorithmParameters object must be passed to * the Cipher.init() method. */ System.out.println("Return shared secret as SecretKey object ..."); // Bob // NOTE: The call to bobKeyAgree.generateSecret above reset the key // agreement object, so we call doPhase again prior to another // generateSecret call bobKeyAgree.doPhase(alicePubKey, true); SecretKey bobDesKey = bobKeyAgree.generateSecret("DES"); // Alice // NOTE: The call to aliceKeyAgree.generateSecret above reset the key // agreement object, so we call doPhase again prior to another // generateSecret call aliceKeyAgree.doPhase(bobPubKey, true); SecretKey aliceDesKey = aliceKeyAgree.generateSecret("DES"); /* * Bob encrypts, using DES in ECB mode */ Cipher bobCipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); bobCipher.init(Cipher.ENCRYPT_MODE, bobDesKey); byte[] cleartext = "This is just an example".getBytes(); byte[] ciphertext = bobCipher.doFinal(cleartext); /* * Alice decrypts, using DES in ECB mode */ Cipher aliceCipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); aliceCipher.init(Cipher.DECRYPT_MODE, aliceDesKey); byte[] recovered = aliceCipher.doFinal(ciphertext); if (!java.util.Arrays.equals(cleartext, recovered)) throw new Exception("DES in CBC mode recovered text is " + "different from cleartext"); System.out.println("DES in ECB mode recovered text is " + "same as cleartext"); /* * Bob encrypts, using DES in CBC mode */ bobCipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); bobCipher.init(Cipher.ENCRYPT_MODE, bobDesKey); cleartext = "This is just an example".getBytes(); ciphertext = bobCipher.doFinal(cleartext); // Retrieve the parameter that was used, and transfer it to Alice in // encoded format byte[] encodedParams = bobCipher.getParameters().getEncoded(); /* * Alice decrypts, using DES in CBC mode */ // Instantiate AlgorithmParameters object from parameter encoding // obtained from Bob AlgorithmParameters params = AlgorithmParameters.getInstance("DES"); params.init(encodedParams); aliceCipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); aliceCipher.init(Cipher.DECRYPT_MODE, aliceDesKey, params); recovered = aliceCipher.doFinal(ciphertext); if (!java.util.Arrays.equals(cleartext, recovered)) throw new Exception("DES in CBC mode recovered text is " + "different from cleartext"); System.out.println("DES in CBC mode recovered text is " + "same as cleartext"); } /* * Converts a byte to hex digit and writes to the supplied buffer */ private void byte2hex(byte b, StringBuffer buf) { char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; int high = ((b & 0xf0) >> 4); int low = (b & 0x0f); buf.append(hexChars[high]); buf.append(hexChars[low]); } /* * Converts a byte array to hex string */ private String toHexString(byte[] block) { StringBuffer buf = new StringBuffer(); int len = block.length; for (int i = 0; i < len; i++) { byte2hex(block[i], buf); if (i < len-1) { buf.append(":"); } } return buf.toString(); } /* * Prints the usage of this test. */ private void usage() { System.err.print("DHKeyAgreement usage: "); System.err.println("[-gen]"); } // The 1024 bit Diffie-Hellman modulus values used by SKIP private static final byte skip1024ModulusBytes[] = { (byte)0xF4, (byte)0x88, (byte)0xFD, (byte)0x58, (byte)0x4E, (byte)0x49, (byte)0xDB, (byte)0xCD, (byte)0x20, (byte)0xB4, (byte)0x9D, (byte)0xE4, (byte)0x91, (byte)0x07, (byte)0x36, (byte)0x6B, (byte)0x33, (byte)0x6C, (byte)0x38, (byte)0x0D, (byte)0x45, (byte)0x1D, (byte)0x0F, (byte)0x7C, (byte)0x88, (byte)0xB3, (byte)0x1C, (byte)0x7C, (byte)0x5B, (byte)0x2D, (byte)0x8E, (byte)0xF6, (byte)0xF3, (byte)0xC9, (byte)0x23, (byte)0xC0, (byte)0x43, (byte)0xF0, (byte)0xA5, (byte)0x5B, (byte)0x18, (byte)0x8D, (byte)0x8E, (byte)0xBB, (byte)0x55, (byte)0x8C, (byte)0xB8, (byte)0x5D, (byte)0x38, (byte)0xD3, (byte)0x34, (byte)0xFD, (byte)0x7C, (byte)0x17, (byte)0x57, (byte)0x43, (byte)0xA3, (byte)0x1D, (byte)0x18, (byte)0x6C, (byte)0xDE, (byte)0x33, (byte)0x21, (byte)0x2C, (byte)0xB5, (byte)0x2A, (byte)0xFF, (byte)0x3C, (byte)0xE1, (byte)0xB1, (byte)0x29, (byte)0x40, (byte)0x18, (byte)0x11, (byte)0x8D, (byte)0x7C, (byte)0x84, (byte)0xA7, (byte)0x0A, (byte)0x72, (byte)0xD6, (byte)0x86, (byte)0xC4, (byte)0x03, (byte)0x19, (byte)0xC8, (byte)0x07, (byte)0x29, (byte)0x7A, (byte)0xCA, (byte)0x95, (byte)0x0C, (byte)0xD9, (byte)0x96, (byte)0x9F, (byte)0xAB, (byte)0xD0, (byte)0x0A, (byte)0x50, (byte)0x9B, (byte)0x02, (byte)0x46, (byte)0xD3, (byte)0x08, (byte)0x3D, (byte)0x66, (byte)0xA4, (byte)0x5D, (byte)0x41, (byte)0x9F, (byte)0x9C, (byte)0x7C, (byte)0xBD, (byte)0x89, (byte)0x4B, (byte)0x22, (byte)0x19, (byte)0x26, (byte)0xBA, (byte)0xAB, (byte)0xA2, (byte)0x5E, (byte)0xC3, (byte)0x55, (byte)0xE9, (byte)0x2F, (byte)0x78, (byte)0xC7 }; // The SKIP 1024 bit modulus private static final BigInteger skip1024Modulus = new BigInteger(1, skip1024ModulusBytes); // The base used with the SKIP 1024 bit modulus private static final BigInteger skip1024Base = BigInteger.valueOf(2); }
/* * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Oracle nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.io.*; import java.math.BigInteger; import java.security.*; import java.security.spec.*; import java.security.interfaces.*; import javax.crypto.*; import javax.crypto.spec.*; import javax.crypto.interfaces.*; import com.sun.crypto.provider.SunJCE; /** * This program executes the Diffie-Hellman key agreement protocol * between 3 parties: Alice, Bob, and Carol. * * We use the same 1024-bit prime modulus and base generator that are * used by SKIP. */ public class DHKeyAgreement3 { private DHKeyAgreement3() {} public static void main(String argv[]) { try { DHKeyAgreement3 keyAgree = new DHKeyAgreement3(); keyAgree.run(); } catch (Exception e) { System.err.println("Error: " + e); System.exit(1); } } private void run() throws Exception { DHParameterSpec dhSkipParamSpec; System.out.println("Using SKIP Diffie-Hellman parameters"); dhSkipParamSpec = new DHParameterSpec(skip1024Modulus, skip1024Base); // Alice creates her own DH key pair System.out.println("ALICE: Generate DH keypair ..."); KeyPairGenerator aliceKpairGen = KeyPairGenerator.getInstance("DH"); aliceKpairGen.initialize(dhSkipParamSpec); KeyPair aliceKpair = aliceKpairGen.generateKeyPair(); // Bob creates his own DH key pair System.out.println("BOB: Generate DH keypair ..."); KeyPairGenerator bobKpairGen = KeyPairGenerator.getInstance("DH"); bobKpairGen.initialize(dhSkipParamSpec); KeyPair bobKpair = bobKpairGen.generateKeyPair(); // Carol creates her own DH key pair System.out.println("CAROL: Generate DH keypair ..."); KeyPairGenerator carolKpairGen = KeyPairGenerator.getInstance("DH"); carolKpairGen.initialize(dhSkipParamSpec); KeyPair carolKpair = carolKpairGen.generateKeyPair(); // Alice initialize System.out.println("ALICE: Initialize ..."); KeyAgreement aliceKeyAgree = KeyAgreement.getInstance("DH"); aliceKeyAgree.init(aliceKpair.getPrivate()); // Bob initialize System.out.println("BOB: Initialize ..."); KeyAgreement bobKeyAgree = KeyAgreement.getInstance("DH"); bobKeyAgree.init(bobKpair.getPrivate()); // Carol initialize System.out.println("CAROL: Initialize ..."); KeyAgreement carolKeyAgree = KeyAgreement.getInstance("DH"); carolKeyAgree.init(carolKpair.getPrivate()); // Alice uses Carol's public key Key ac = aliceKeyAgree.doPhase(carolKpair.getPublic(), false); // Bob uses Alice's public key Key ba = bobKeyAgree.doPhase(aliceKpair.getPublic(), false); // Carol uses Bob's public key Key cb = carolKeyAgree.doPhase(bobKpair.getPublic(), false); // Alice uses Carol's result from above aliceKeyAgree.doPhase(cb, true); // Bob uses Alice's result from above bobKeyAgree.doPhase(ac, true); // Carol uses Bob's result from above carolKeyAgree.doPhase(ba, true); // Alice, Bob and Carol compute their secrets byte[] aliceSharedSecret = aliceKeyAgree.generateSecret(); System.out.println("Alice secret: " + toHexString(aliceSharedSecret)); byte[] bobSharedSecret = bobKeyAgree.generateSecret(); System.out.println("Bob secret: " + toHexString(bobSharedSecret)); byte[] carolSharedSecret = carolKeyAgree.generateSecret(); System.out.println("Carol secret: " + toHexString(carolSharedSecret)); // Compare Alice and Bob if (!java.util.Arrays.equals(aliceSharedSecret, bobSharedSecret)) throw new Exception("Alice and Bob differ"); System.out.println("Alice and Bob are the same"); // Compare Bob and Carol if (!java.util.Arrays.equals(bobSharedSecret, carolSharedSecret)) throw new Exception("Bob and Carol differ"); System.out.println("Bob and Carol are the same"); } /* * Converts a byte to hex digit and writes to the supplied buffer */ private void byte2hex(byte b, StringBuffer buf) { char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; int high = ((b & 0xf0) >> 4); int low = (b & 0x0f); buf.append(hexChars[high]); buf.append(hexChars[low]); } /* * Converts a byte array to hex string */ private String toHexString(byte[] block) { StringBuffer buf = new StringBuffer(); int len = block.length; for (int i = 0; i < len; i++) { byte2hex(block[i], buf); if (i < len-1) { buf.append(":"); } } return buf.toString(); } /* * Prints the usage of this test. */ private void usage() { System.err.print("DHKeyAgreement usage: "); System.err.println("[-gen]"); } // The 1024 bit Diffie-Hellman modulus values used by SKIP private static final byte skip1024ModulusBytes[] = { (byte)0xF4, (byte)0x88, (byte)0xFD, (byte)0x58, (byte)0x4E, (byte)0x49, (byte)0xDB, (byte)0xCD, (byte)0x20, (byte)0xB4, (byte)0x9D, (byte)0xE4, (byte)0x91, (byte)0x07, (byte)0x36, (byte)0x6B, (byte)0x33, (byte)0x6C, (byte)0x38, (byte)0x0D, (byte)0x45, (byte)0x1D, (byte)0x0F, (byte)0x7C, (byte)0x88, (byte)0xB3, (byte)0x1C, (byte)0x7C, (byte)0x5B, (byte)0x2D, (byte)0x8E, (byte)0xF6, (byte)0xF3, (byte)0xC9, (byte)0x23, (byte)0xC0, (byte)0x43, (byte)0xF0, (byte)0xA5, (byte)0x5B, (byte)0x18, (byte)0x8D, (byte)0x8E, (byte)0xBB, (byte)0x55, (byte)0x8C, (byte)0xB8, (byte)0x5D, (byte)0x38, (byte)0xD3, (byte)0x34, (byte)0xFD, (byte)0x7C, (byte)0x17, (byte)0x57, (byte)0x43, (byte)0xA3, (byte)0x1D, (byte)0x18, (byte)0x6C, (byte)0xDE, (byte)0x33, (byte)0x21, (byte)0x2C, (byte)0xB5, (byte)0x2A, (byte)0xFF, (byte)0x3C, (byte)0xE1, (byte)0xB1, (byte)0x29, (byte)0x40, (byte)0x18, (byte)0x11, (byte)0x8D, (byte)0x7C, (byte)0x84, (byte)0xA7, (byte)0x0A, (byte)0x72, (byte)0xD6, (byte)0x86, (byte)0xC4, (byte)0x03, (byte)0x19, (byte)0xC8, (byte)0x07, (byte)0x29, (byte)0x7A, (byte)0xCA, (byte)0x95, (byte)0x0C, (byte)0xD9, (byte)0x96, (byte)0x9F, (byte)0xAB, (byte)0xD0, (byte)0x0A, (byte)0x50, (byte)0x9B, (byte)0x02, (byte)0x46, (byte)0xD3, (byte)0x08, (byte)0x3D, (byte)0x66, (byte)0xA4, (byte)0x5D, (byte)0x41, (byte)0x9F, (byte)0x9C, (byte)0x7C, (byte)0xBD, (byte)0x89, (byte)0x4B, (byte)0x22, (byte)0x19, (byte)0x26, (byte)0xBA, (byte)0xAB, (byte)0xA2, (byte)0x5E, (byte)0xC3, (byte)0x55, (byte)0xE9, (byte)0x2F, (byte)0x78, (byte)0xC7 }; // The SKIP 1024 bit modulus private static final BigInteger skip1024Modulus = new BigInteger(1, skip1024ModulusBytes); // The base used with the SKIP 1024 bit modulus private static final BigInteger skip1024Base = BigInteger.valueOf(2); }
/* * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Oracle nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; /** * This program generates a Blowfish key, retrieves its raw bytes, and * then reinstantiates a Blowfish key from the key bytes. * The reinstantiated key is used to initialize a Blowfish cipher for * encryption. */ public class BlowfishKey { public static void main(String[] args) throws Exception { KeyGenerator kgen = KeyGenerator.getInstance("Blowfish"); SecretKey skey = kgen.generateKey(); byte[] raw = skey.getEncoded(); SecretKeySpec skeySpec = new SecretKeySpec(raw, "Blowfish"); Cipher cipher = Cipher.getInstance("Blowfish"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal("This is just an example".getBytes()); } }
/* * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Oracle nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.security.*; import javax.crypto.*; /** * This program demonstrates how to generate a secret-key object for * HMAC-MD5, and initialize an HMAC-MD5 object with it. */ public class initMac { public static void main(String[] args) throws Exception { // Generate secret key for HMAC-MD5 KeyGenerator kg = KeyGenerator.getInstance("HmacMD5"); SecretKey sk = kg.generateKey(); // Get instance of Mac object implementing HMAC-MD5, and // initialize it with the above secret key Mac mac = Mac.getInstance("HmacMD5"); mac.init(sk); byte[] result = mac.doFinal("Hi There".getBytes()); } }
/* * @(#)ReadPassword.java 1.1 06/06/07 * * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.util.*; import java.io.*; import java.security.*; public class ReadPassword { /** * Read a password from the InputStream "in". * <p> * As Strings are immutable, passwords should be stored as an array * of characters, which can be blanked out when no longer needed. * <p> * If the provided InputStream is the System's Console, this method * uses the non-echoing readPassword() method of java.io.Console * (new to JDK 6). If not, a fallback implementation is used. * <p> * NOTE: For expository purposes, and because some applications do * not understand multi-byte characters, only 8-bit ASCII passwords * are handled here. * <p> * NOTE: If a SecurityManager is used, the default standard * java.policy file found in the JDK (i.e. * <java-home>/lib/security/java.policy) allows reading the * line.separator property. If your environment is different, this * code will need to be granted the appropriate privilege. * * @param in * the InputStream used to obtain the password. * * @return A character array containing the password or passphrase, * not including the line-termination characters, * or null if an end of stream has been reached. * * @throws IOException * if an I/O problem occurs */ public static final char[] readPassword(InputStream in) throws IOException { /* * If available, directly use the java.io.Console class to * avoid character echoing. */ if (in == System.in && System.console() != null) { // readPassword returns "" if you just print ENTER, return System.console().readPassword(); } /* * If a console is not available, read the InputStream * directly. This approach may cause password echoing. * * Since different operating systems have different End-Of-Line * (EOL) sequences, this algorithm should allow for * platform-independent implementations.  However, some OS's use a single * a carriage return ('\r'), which complicates portability. * * Since we may not have the ability to push bytes back into the * InputStream, another approach is used here. The javadoc for * <code>java.lang.System.getProperties()</code> specifies that * the set of system properties will contain a system-specific * value for the "line.separator". Scan for this character * sequence instead of hard-coding a particular sequence. */ /* * Enclose the getProperty in a doPrivileged block to minimize * the call stack permission required. */ char [] EOL = AccessController.doPrivileged( new PrivilegedAction<char[]>() { public char[] run() { String s = System.getProperty("line.separator"); // Shouldn't happen. if (s == null) { throw new RuntimeException( "line.separator not defined"); } return s.toCharArray(); } }); char [] buffer = new char[128]; try { int len = 0; // len of data in buffer. boolean done = false; // found the EOL sequence int b; // byte read while (!done) { /* * realloc if necessary */ if (len >= buffer.length) { char [] newbuffer = new char[len + 128]; System.arraycopy(buffer, 0, newbuffer, 0, len); Arrays.fill(buffer, ' '); buffer = newbuffer; } /* * End-of-Stream? */ if ((b = in.read()) == -1) { // Return as much as we have, null otherwise. if (len == 0) { return null; } break; } else { /* * NOTE: In the simple PBE example here, * only 8 bit ASCII characters are handled. */ buffer[len++] = (char) b; } /* * check for the EOL sequence. Do we have enough bytes? */ if (len >= EOL.length) { int i = 0; for (i = 0; i < EOL.length; i++) { if (buffer[len - EOL.length + i] != EOL[i]) { break; } } done = (i == EOL.length); } } /* * If we found the EOL, strip the EOL chars. */ char [] result = new char[done ? len - EOL.length : len]; System.arraycopy(buffer, 0, result, 0, result.length); return result; } finally { /* * Zero out the buffer. */ if (buffer != null) { Arrays.fill(buffer, ' '); } } } }


This is template for doing HTML prototyping using HAML, SASS and component based approach
Based on : Middleman Project Template: HTML5BP HAML
Example pages
Click here to browse around.
Summary of the files
*Pages (that are composed of components and the actual copytext (yml data) should be in folder source)
*Components are in source/components
*Images are under source/images
*Layouts in folder source/layouts. It can be defined page to use some other layout from config.rb
*Helpers are in helpers folder.
*Stylesheets are under source/stylesheet
*External yml data are in separate files under data folder.
Running the commands
Start the middleman by running: "bundle exec middleman"
Build the static site by running: "bundle exec middleman build"
If you want to run in separate port use: "middleman server -p 4567 -e development"


Categories
- WordPress (150 )
- Joomla (100 )
- PSD (50 )
- Plugins (60 )
- Components (40 )
Sort by: New Items


Meditation Process
Process over product is something I need to work on. I get caught up in wanting things to look good from the beginning which just isn't the best way to work, the process is more important. A finished product is what matters most so using too much time on how things look during the process is not good. Add it to the list it!
Before watching the second Search Inside Yourself video I thought of meditiation as something to do to make yourself relaxed. After watching this video I learnt that happiness is always with you, it's not something you pursue, it's there inside you but is just clouded by other things. Meditation clears the clouds of worry, stress and clutteredness and takes you back to your defaut state of mind. Which is happiness.
I learnt that there is a term for when your mind drifts away from concentration and you realise this, it is called meta-attention. Meta-attention is one of the secrets to concentration. If you realise you have drifted out of attention you can train your brain to better concentrate, almost strengthening your concentration like someone does when doing curls in the gym to strengthen their biceps. This technique stood out to me as I do realise a lot when my concentration drifts and I always feel bad this happens, when really it is normal. The part that matters is that you pull your mind back into attention. Doing this when meditating will strengthen your skills to do this in everyday activites or work.
Another technique I want to try and need to work on improving is not automaticly responding to simulis or outside distractions, e.g a itch, your phone buzzing, thinking of an issue. If you don't react to this straight away your have control of your mindfullness. Give yourself 4-5 breaths before reacting and you will be in control.


OES Rust Core Simulators
The code of these simulators is available under a permissive MIT License. It can be used as a starting point for building your own Object Event simulators.
The code of these simulators is available under a permissive MIT License. It can be used as a starting point for building your own Object Event simulators.


Bitcoin Now
Value for 1 BTC
Bitfinex
BitTrex
Coinbase
Gemini
Kraken
Poloniex
Polls for changes every 10 seconds
Powered by
CryptoCompare


In IT Code fair event students can share their IT skills with each other and get connect with current trend in IT sector.
The Timetable Shows planning for whole day that how this event go on time.
We want to give special thanks to our kindly sponsors who trusted on us.


Merci mon amour.

C’mon. Make sure Stephen Harper can hear you….
Are you ready to bring real change to Ottawa?
That’s good to hear.
Because I’ll tell you something. This is an important election, my friends.
And I’m determined to win it.
What’s left to say about the Conservatives these days? After 10 long years in power, it’s like they’ve stopped trying.
This is Stephen Harper’s eighth election. He’s asking for a fourth term as Prime Minister.
It’s like a bad movie franchise: by the time you get to the third or fourth sequel, most of the stars are gone, and the plot is getting pretty thin.
This government is out of touch and out of ideas. And if we stay focused and work hard, in 2 short weeks they’ll be out of time.
Le temps est venu de se débarrasser de ce gouvernement usé, arrogant et déconnecté de la réalité.
Le gouvernement Harper a passé sa date d’expiration. Il est temps de le remplacer par un meilleur gouvernement.
 But I bet you know what I mean when I say the traffic in the GTA is unbelievable.
It hurts our economy, robs us of time with our kids, and makes it harder to get our goods and services to market.
Frankly, gridlock in this city has never been worse and Stephen Harper doesn’t that.
See: I’ve had the chance over the past few months to spend some quality, up-close-and-personal time with Mr Harper.
We’ve had five debates in this election. Despite the Conservatives’ best efforts, I’m sure you’ve seen a few of them.
There have been some memorable moments.
But my favourite had to be in the debate on the economy in Calgary, when Harper said that he is making it easier for Canadians to get around our cities with his investments in infrastructure.
Really. He actually said that.
Stephen Harper just doesn’t see what you’re going through.
When you spend a decade in a motorcade, you don’t have to worry about traffic jams.
That’s what happens when you’ve been in power too long.
That’s why…
It’s time for a change in this country, my friends. A real change.
It’s time for a clear and honest plan that will meet our challenges head on.
It’s time to invest in transit and roads so we can create the jobs and growth this economy so badly needs.
It’s time to raise taxes on the wealthiest 1%, so we can cut them for the middle class.
It’s time to give middle class families more money to help raise their kids. And it’s time to lift 315,000 children out of poverty.
It’s time for an open and honest government that works hard every day to earn Canadians’ trust by putting its trust in Canadians.
It’s time, my friends, to close the book on the Harper Decade.
Having failed to help Canadians where it matters, what is Stephen Harper left with?
Fear.
The politics of fear and division.
Franklin Roosevelt said we have nothing to fear but fear itself.
Well, Stephen Harper has nothing to offer but fear itself.
Fear of terrorism. Fear of the world beyond our borders. Fear of each other.
Well, let me tell you something.
Fear makes us weak, not strong.
The Prime Minister’s job is to bring Canadians together, not to tear us apart.
In 10 years, Stephen Harper has never missed an opportunity to divide Canadians.
East against west. Urban against rural. French against English. So-called ‘old stock’ Canadians vs newcomers.
His first instinct is to appeal to the worst instincts.
He and his party have brought unprecedented nastiness to our country’s public life.
Their way of doing politics is mean and small and negative.
It doesn’t have to be that way, my friends.
Et M. Mulcair a fait les mauvais choix.
Il a choisi d’équilibrer le budget de Stephen Harper à tout prix.
Le changement qu’il propose, c’est pas avant deux ou trois élections.
Les Canadiens veulent du changement maintenant, pas dans dix ans.
Nous avons un plan qui va créer des emplois et créer de la croissance économique maintenant.
Notre changement, c’est pour tout de suite!
My friends, Canadians want a better government, not just a different one.
It’s time for real change.
Politics is a rough business. It is not for the faint of heart or the thin of skin.
And we can disagree with our political adversaries. We should be strong and sharp and tough in the way we promote our policies and contrast them with those of our opponents.
I’m a fierce competitor. I believe in what we’re doing and I’ll fight hard for it.
But I want you to keep something in mind. Always.
In the end, we are all Canadians.
Conservatives are not our enemies. They’re our neighbours.
They want what’s best for their country, just like we do. They want safe communities and a growing economy. They want better jobs and more opportunities for their kids. They want their country to stand for something in the world, with the tenacity to solve big problems.
We don’t need to convince them to leave the Conservative Party. We just need to show how Stephen Harper’s Party has left them.
Harper wants Canadians to believe that their country is so weak that only thing standing between our safety and terrorism is him.
He wants us to think that if it weren’t for him, our economy would fall apart.
What utter nonsense.
The Canadian economy doesn’t depend on him. It depends on you.
The Canadian economy depends on your work ethic. Your smarts. Your desire to build a better life for your kids and a better country for your fellow citizens.
It’s past time we had a Prime Minister who gets that. A government that knows that Canadians are the strength of the Canadian economy. One that gives Canadians the right tools and a real chance to create jobs and grow the economy.
Harper isn’t protecting this country’s economy.
He’s holding it back; he’s holding us back.
There are many, many issues where Harper and I part ways. But none is greater than this:
Stephen Harper lacks ambition for our country.
His vision of Canada is small and meek and fearful.
My vision of Canada is open and confident and hopeful.
Harper wants Canadians to be afraid that there’s a terrorist hiding behind every leaf and rock. That there’s a sea of economic troubles lapping at our shores.
I don’t see things that way. I have confidence in Canada and in Canadians. We have won tougher fights, and solved greater problems in the past than we face today.
The country that fought like lions in the trenches of WW1 and on the beaches of WW2 is not as easily cowed as Stephen Harper thinks we are.
The people who built medicare and the Canada Pension Plan are not afraid of doing the hard work it will take to strengthen the middle class and lift Canadians out of poverty.
Related: Justin and Pierre—like father, like son. Only, not always.
And let me tell you this my friends, we are the one country in the world that is strong not in spite of our differences, but because of them.
That didn’t happen by accident and it won’t continue without leadership. Leadership that works hard every minute of every day to bring Canadians together.
Stephen Harper’s leadership is not the solution to Canada’s problems. It is Canada’s problem.
And all this talk of fear begs the question: what is it that Stephen Harper is so afraid of?
With the many millions upon millions of dollars he’s spent on attack ads, lots of people ask if I think he’s afraid of me.
I don’t.
Stephen Harper isn’t afraid of me, my friends.
He’s afraid of you.
And he should be (afraid of you).
His worst nightmare is a confident and hopeful citizen who demands better for her country.
He wants you to believe that better isn’t possible. His job depends on it.
Well, we’ve got news for you, Mr Harper:
This is Canada. And in Canada, better is always possible.
This is a great country, my friends.
It needs a better government.
Three years ago this week, we started this journey together.
My hair was a little longer then. Sophie still prefers it that way.
My friends, we’ve been through a lot, together, since then. The polls have gone up and down. The pundits have lauded us and lamented us.
None of that matters. It never has. And it never will.
I’ll tell you what does matter.
We spent those years looking thousands and thousands of Canadians straight in the eye and asking simple questions:
What kind of country do you want to build?
What kind of Canada do you want to leave to your kids?
Do you want Stephen Harper’s unambitious vision of a small, fearful country? One where we are divided against one another and suspicious of the world.
Or do you want a confident, positive vision of Canada? One that is clear-eyed about the challenges we face, but optimistic that we have all that we need to meet them head on.
I believe in this country. I love it with all my heart. And I know you do too.
See: our campaign has never been about me. It has never been about the Liberal Party. It has always been about Canadians.
Never forget who we are fighting for. We are in this for the mom who lives in Brampton and works in Markham. She needs to get her kids to school on time every morning, and, hopefully, make it back home in time for their soccer game.
We are in it for the young man whose parents brought him to Mississauga from Lahore. Whose dreams for his future are so much larger than his parents had ever thought possible.
We are in it for seniors who worked hard their whole lives. Who helped their city and their country grow, and want nothing in return but a secure and dignified retirement.
In short, we are in this for everyday Canadians. People who give a lot and ask for little. Who want what’s best for their family and their community and their country.
Canadians who deserve a better government.
C’est assez.
C’est assez d’un gouvernement qui ne nous écoute pas, qui ne nous comprend pas.
C’est assez d’un gouvernement qui a une vision étroite de ce que ce pays peut être et doit être.
C’est assez d’un Premier ministre qui choisit la division et la peur plutôt que de rassembler et de rassurer.
C’est assez!
On est mieux que ça.
En tant que Québécois, en tant que Canadien, je sais qu’on a toujours rêvé grand.
On a toujours été prêt à investir dans notre avenir.
À bâtir ensemble.
Il est temps qu’on s’y mette.
Il est temps que le Canada redevienne le pays de nos ambitions!
There are two weeks left. 14 days. Let’s make the most of every minute.
Harper’s Conservatives are going to do the only thing they know how to do. They’ll throw every nasty ad and every dirty trick in the book at us.
That’s the way they came into office. It’s the way they’ve governed. And it’s the way they’ll go out.
But I’ll tell you something.
Because of all your hope and hard work, we are on the verge of something special.
We have the chance to beat fear with hope.
We have the chance to beat cynicism with hard work.
We have the chance to prove that fear and division won’t work here. Not in Canada.
We have the chance to replace a vision of this country that’s small and mean and nasty with a vision that’s confident and optimistic and positive.
Most of all, we have the chance to take this country from Stephen Harper and give it back to Canadians.
And the whole world will be amazed at what we do with it.
Stay hopeful. Never stop working hard.
A better Canada is possible my friends.
On October the 19th, let’s make it happen.
Merci mes amis!


XPath2MemoryManager Class Reference
#include <XPath2MemoryManager.hpp>
List of all members.
Constructor & Destructor Documentation
| virtual XPath2MemoryManager::~XPath2MemoryManager |
( |
|
) |
[inline, virtual] |
Member Function Documentation
| virtual void* XPath2MemoryManager::allocate |
( |
size_t |
numElements |
) |
[pure virtual] |
| virtual Collation* XPath2MemoryManager::createCollation |
( |
CollationHelper * |
helper |
) |
[pure virtual] |
| virtual ATDecimalOrDerived* XPath2MemoryManager::createInteger |
( |
int |
value |
) |
[pure virtual] |
| virtual XQillaNSResolver* XPath2MemoryManager::createNSResolver |
( |
xercesc::DOMNode * |
resolverNode |
) |
[pure virtual] |
| virtual VariableTypeStore* XPath2MemoryManager::createVariableTypeStore |
( |
|
) |
[pure virtual] |
create a store for variables
| virtual void XPath2MemoryManager::deallocate |
( |
void * |
p |
) |
[pure virtual] |
This method deallocates memory.
- Parameters:
-
| p | The pointer to the allocated memory to be deleted |
Implements xercesc::MemoryManager.
| virtual void XPath2MemoryManager::dumpStatistics |
( |
|
) |
const [pure virtual] |
| virtual size_t XPath2MemoryManager::getAllocatedObjectCount |
( |
|
) |
const [pure virtual] |
| virtual const XMLCh* XPath2MemoryManager::getPooledString |
( |
const char * |
src |
) |
[pure virtual] |
| virtual const XMLCh* XPath2MemoryManager::getPooledString |
( |
const XMLCh * |
src, |
|
|
unsigned int |
length | |
|
) |
| | [pure virtual] |
| virtual const XMLCh* XPath2MemoryManager::getPooledString |
( |
const XMLCh * |
src |
) |
[pure virtual] |
| virtual const StringPool* XPath2MemoryManager::getStringPool |
( |
|
) |
const [pure virtual] |
| virtual size_t XPath2MemoryManager::getTotalAllocatedMemory |
( |
|
) |
const [pure virtual] |
| virtual void XPath2MemoryManager::reset |
( |
|
) |
[pure virtual] |
Use with extreme caution!
The documentation for this class was generated from the following file:


helib::PolyModRing Struct Reference
Lightweight type for describing the structure of a single slot of the plaintext space. More...
#include <PolyModRing.h>
Public Member Functions | |
| PolyModRing & | operator= (const PolyModRing &)=delete |
| PolyModRing & | operator= (PolyModRing &&)=delete |
| PolyModRing (const PolyModRing &other)=default | |
| Copy constructor. | |
| PolyModRing (PolyModRing &&other)=default | |
| Move constructor. | |
| ~PolyModRing ()=default | |
| Destructor. | |
| PolyModRing (long p, long r, const NTL::ZZX &G) | |
| Constructor. More... | |
| bool | operator== (const PolyModRing &rhs) const noexcept |
| Equality operator. | |
| bool | operator!= (const PolyModRing &rhs) const noexcept |
| Not-equals operator. | |
Public Attributes | |
| const long | p |
| The characteristic of the plaintext space. This should be prime. | |
| const long | r |
| The power of p used in the plaintext space coefficient modulus. | |
| const NTL::ZZX | G |
| The irreducible factor of Phi_m(X) used for the algebra of the individual slots. | |
| const long | p2r |
| The plaintext space coefficient modulus, equal to p^r. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const PolyModRing &ring) |
| Output shift operator. More... | |
Detailed Description
Lightweight type for describing the structure of a single slot of the plaintext space.
A single slot of the plaintext space is isomorphic to for some irreducible factor G of , so the main useful members of this struct
are p
, r
, G
, and p2r
.
The fields of this struct
are all const
, so they should be determined at the time of construction.
- Note
- This
struct
aggregates this often-useful information into a single placeholder for convenience.
Constructor & Destructor Documentation
◆ PolyModRing()
| helib::PolyModRing::PolyModRing | ( | long | p, |
| long | r, | ||
| const NTL::ZZX & | G | ||
| ) |
Constructor.
- Parameters
-
p The characteristic of the plaintext space. r The power of p used in the plaintext space coefficient modulus. G The irreducible factor of Phi_m(X) used for the algebra of the individual slots.
p^r will be calculated automatically.
- Note
- p should be a prime number.
Friends And Related Function Documentation
◆ operator<<
|
friend |
Output shift operator.
- Parameters
-
os Output std::ostream
.ring PolyModRing
object to be written.
- Returns
- Input
std::ostream
post writing.
The documentation for this struct was generated from the following files:
- include/helib/PolyModRing.h
- src/PolyModRing.cpp


Victoria Hostel Road in Chepauk turns into dump yard
Construction debris is being dumped along the road for the past two weeks
by D. MadhavanFor the last two weeks, commuters heading to Chepauk Railway Station on Victoria Hostel Road are being greeted by piles of trash, mostly construction debris. They say that miscreants are taking advantage of the location, which is more often than not isolated, and dumping waste clandestinely.
“Heaps of garbage have been dumped near the main entrance of the railway station along the Buckingham Canal. This has been going on for the past two weeks and the officials of the Greater Chennai Corporation don’t seem to have taken any action. Overlooking such violations will only encourage more encroachments of public spaces. Victoria Hostel is badly in need of street lights and police patrol,” says S. Lokesh, a commuter from Triplicane.
Motorists complain the police patrolling is limited to the intersection of Bells Road and Pycrofts Road, and opposite the State Guest House on Wallajah Road. “This road is often ignored. There are no CCTV cameras installed on this stretch to monitor the movement of people and vehicles,” says a motorist.
When contacted, an official from the Greater Chennai Corporation promised to inspect the stretch and remove the garbage.


Welcome!
Come and meet the team!
Soon to be Graduate from Lambda's Full Stack Web Development program.
Nothing special, just some guy from Missouri whose learning to code at Lambda and enjoying it a lot. Check back later and maybe I'll make my bio interesting also...probably not.
Currently a student at Lambda School and just finished the backend portion of the course.
Currently enrolled in Lambda School's Full Stack Web Development program. Previously worked in the biotech industry in cancer research and prior to biotech worked at Uber office headquarters in Boston. Enjoys working in javascript and CSS and HTML
Kevin is currently a full-stack web development student at Lambda. He previously worked in customer service in the gaming industry. He enjoys working on various aspects of front-end, from creating beautiful web designs to building interactive user experiences. He looks forward to learning all stages of development and expand his skills.


Find Dialog Box (Found One)
Previous
Top
Next
(This Find dialog indicates that a message that meets your search criteria has been found.)
If you want to see if there is another instance of your search text within the same message, click the
Next in Msg
button.
If you want to move to the next message that matches your search criteria click the
Next
button.
If you'd like to mark this message before moving on to find the next message click the
Mark
button.
Click the
Close
button to stop the search.


The Jarvis AI allow you to do anything you want like that ask weather, ask gold rate, play music, post Facebook, calculate, control light, TV, robot...
List of command:
Jarvis bot Developed by Cao The Toan


The future of fitness is here
Work out with friends
For extra motivation, turn on the leaderboard and compete with your friends!
Climb up to the top and beat your high score each time.
Leave the rep counting to us
Focus on your goals—we’ve got the rest, including a real-time rep count on the screen so you know exactly where you are in every workout.
Leave the rep counting to us
We’ll help you improve your form so you get the best results and avoid injury.
Your coach tells you to “bend lower”, straighten your back”, and “jump highter” with instant audio feedback.


POST
Active features by customerDescription:
REST API which allows to query what features are ON or OFF given a customer.
Bearer Token:
{{ bearerToken }}
Required Parameters: *
Optional Parameters:
URL Preview:
POST {{ endpointUrl }} HTTP/1.1
Body:
{{ requestBody | json | default: 'No body yet.' }}
Response:
{{ jsonResponse | json | default: 'No response yet.' }}


Simple Returns¶
What is Simple Returns?¶
Simple Returns is our popular, open-source RMA extension. We are steadfast believers in the value of open source, which is why we provide an open-source option for the overwhelming majority of our extensions. Simple Returns provides enhanced RMA functionality for Magento Open Source. It extends the default RMA capabilities built into Magento Open Source and offers several additional features, including:
Customer features¶
Create, edit RMA requests from frontend
Create, edit, delete RMA file attachments
Receive updates via email
Generate shipping label upon RMA approval
Available to registered customers and guests
Administrator features¶
Create, edit RMA requests
Create RMA packages (return shipments)
Generate, print shipping labels
Supports several carriers, like Fedex and UPS
Customizable RMA fields (e.g. reasons, resolutions, statuses)
Developer features¶
Dependable and extensible (Simple Returns Pro is living proof!)
Plugin-friendly classes and methods
Events dispatched for most major actions
Actively maintained by Aurora Extensions, an ExtDN member and Magento partner


Adaptive Framework for Learning
Adaptive Course Planner for {{ student }}
Proposed Plan 1 - {{ plan1 }}
Proposed Plan 2 - {{ plan2 }}
Proposed Plan 3 - {{ plan3 }}


| Class | Description |
|---|---|
| ErrorCategory |
Defines broad categories of microservice errors.
|
| Exception | Description |
|---|---|
| BadRequestError |
Errors due to improper user requests, like
missing or wrong parameters
|
| BuildError |
Errors happened during microservice build process
and caused by problems in component factories
|
| CallError |
Errors returned by remote services or network during call attempts
|
| ConfigError |
Errors related to mistakes in microservice user-defined configuration
|
| ConflictError |
Errors raised by conflict in object versions
posted by user and stored on server.
|
| ConnectionError |
Errors happened during connection to remote services.
|
| FileError |
Errors in read/write file operations
|
| MicroserviceError |
Base class for all errors thrown by microservice implementation
|
| NotFoundError |
Error caused by attempt to access missing object
|
| StateError |
Errors related to operations called in wrong component state.
|
| UnauthorizedError |
Access errors caused by missing user identity or security permissions
|
| UnknownError |
Internal errors caused by programming or unexpected errors
|
| UnsupportedError |
Errors caused by calls to unsupported
or not yet implemented functionality
|
Copyright © 2016. All rights reserved.


Huntsville's Professional Network
Create a profile for yourself so that you can be found on the site. Add your name, photo, bio, industries, website, Linkedin, and Twitter account.
Start your search for a local expert. Click the "Find" button to search from among hundreds of Huntsville-based freelancers, moonlighters, and consultants.
#openHSV was created by the community, for the community. We wanted to build a resource for our businesses and a tool that connects us.
If you want to help others and see your business grow, wait no longer. The heart of #openHSV is wrapped in the credo which we stand behind.
We are Huntsville


Jaqueline Jossa's mum pleads with fans to stop voting her for Bushtucker trials
They think she has already proven herself and someone else should be voted.
by Georgia LoganJacqueline Jossa's mum has begged I'm A Celebrity... Get Me Out Of Here! viewers to stop voting her for Bushtucker Trials.
Concerned mother Selina has followed calls from the former EastEnders star's husband Dan Osborne after he pleaded with fans to back off, and now she has urged people to "vote for someone else".
Read More: I'm A Celebrity viewers think that Andrew Maxwell will be voted out first
She told the Mirror Online: "It is a lot for her. I think she has proven herself so they could vote for someone else.
"There are trials where they all take part and she is doing them as well as the other ones. She needs a little break."
However, Selina thinks she could be partly to blame for this as she admitted they have such a "big family" who were all told to vote for Jacqueline.
She admitted: "It is partly my fault because we have got a really big family in Ireland and I think they all keep voting for her because I told them to at the start."
Read More: Ant McPartlin and Dec Donnelly hit back as viewers claim I'm A Celebrity live trial was 'fixed'
Selina's comments come after Dan made a similar plea on social media as he asked fans to stop choosing her for horrible tasks on the jungle show.
In a video posted online, he said: "Give her a break please because she's getting upset now. I know I said you all vote for Jac cos she's ain't in there to change lightbulbs - but I didn't mean every single trial.
"Give her a break now, come on. But she keeps smashing them all. She's worried about it but she'll smash it.
"She'll keep proving, everyone. Let her do this one then give her a break please because she's getting upset now and it ain't nice. But she'll get all the stars, smash it and then go back and have a nice dinner."
His comments come after Jacqueline was voted to do the Crevice of Cruelty trial.
Read More: Dec Donnelly hits back as James Haskell 'snaps' at him during I'm A Celebrity live trial
On finding out herself and former footballer Ian Wright would be taking on the trial, Jacqueline broke down in tears, admitting: "I don't want to do any more man."
Leave us a comment on our Facebook page @EntertainmentDailyFix and let us know what you think of this story.


404
Sorry, we couldn't reach the page you were looking for;
I can take you to the homepage..
Take me


Patient Information
Awaiting Data
This list is not authoratitive - check ICIP.
Upcoming Tasks
Awaiting Data
This list is not authoratitive - check ICIP.
Warnings
Awaiting Data
Technical warnings from our system
Enviroment
Awaiting Data
Temperature and sound data captured by this module.
Controls
Press red to reset warnings.
Press yellow to report technical fault.
Press green to request Float Nurse.
Press blue to request HCA.


{% extends "base.html" %} {# Add or edit a doctor patient relation. actionName: is the type of action you are performing eg. "Add" or "Edit".#} {% block content %}


--- layout: post title: Khadi mauri herbal shikakai hair oil tags: - Khadi status: publish type: post published: true meta: _edit_last: '2' _graphene_slider_img: global _graphene_slider_imgurl: '' _graphene_show_addthis: global al2fb_facebook_image_id: '1389' _aioseop_title: Khadi mauri herbal shikakai hair oil _aioseop_keywords: Khadi mauri herbal shikakai hair oil, Khadi herbal shikakai hair oil al2fb_facebook_link_id: '218440691518395_289705794391884' al2fb_facebook_link_time: '2011-10-14T19:36:07+00:00' al2fb_facebook_link_picture: meta=http://missenchanted.com/wp-content/uploads/2011/09/IMG_1341-150x150.jpg _yoast_wpseo_linkdex: '0' _thumbnail_id: '1389' --- I have been nourishing my locks with parachute coconut oil since childhood, although I had tried Vatika once long time back. I have experimented with hair spa creams but never with oil.... maybe because there were not much options. Khadi name itself makes you believe that the product is going to be safe and herbal :) .. Its just a thought and not a proof.. please pardon me :P Price : Rs.64 for 210ml... thats dirt cheap Contains:Pros:


THELMA AND LOUISE A film review by James Davis Nicoll Copyright James Davis Nicoll
May 31, 1956
THELMA AND LOUISE is the most recent attempt by Hollywood to cash in on sci-fi. The film is set 35 years in the future and the director chose to avoid the cliches of other B films (Giant insects, Atomic war, Alien invasions) and try for a more 'realistic' feel by looking at the future from the point of view of two women. I suppose it is the same reason UNCLE TOM'S CABIN used a coloured man as the main character; you get a different perspective from underneath. I'm a big fan of sci-fi, and I had high hopes for this film, but unfortunately, what Ridley Scott has produced is a smutty dystopia, whose technology is scarcely more advanced than our own.
First Big Mistake: The Setting
Scott chose to set THELMA AND LOUISE in a backwater state. While this means he didn't have to pay for the expensive sets portraying a futuristic city, which his accountant no doubt thanked him for, it also means that the two characters spend most of their time driving around scenery that seems not to have changed in any major way in the next three and a half decades (well, once or twice, you do get to see what seems to be the Interstate and National Defense road system, but that's just something we're working on *now*, scarcely futuristic). Now, while it makes sense that the two women would want to keep to the backroads, surely in 35 years, we'd have better backroads than dirt and the occasional hardtop.
Second Big Mistake: The Story
THELMA AND LOUISE is at best described as pornographic. Sex scenes abound, and the subject of sex seems to be a major theme in the movie. Now, there's nothing wrong with the occasional kiss or whatever, if it is handled with taste, but this movie goes far beyond good taste. Worse, it is inconsistent. On one hand, Scott presents a future where women apparently have relations with men on a fairly casual basis (One of the women claims not to have "had" any one but her husband, but falls into bed with a hitchhiker the women pick up and the other woman acts pleased that this happened), but women also seem to be the target of continual unwanted advances, and if the comments of the older woman are correct, women who are raped can't hope to be believed (although given the easy nature of the two women in this film, it is easy to see why). Is sex good or bad? Don't ask Mr. Scott, because he doesn't seem to have made up his mind.
Third Big Mistake: The Technology
To put it mildly, Ridley Scott's 1991 is not very advanced, given the 35 years that have supposedly gone by. The cars don't have fins. Ovens have gotten smaller. There are no videophones, though, and although I looked hard, there didn't seem to be very many pieces of technology that we couldn't built today. They have "microwave ovens," which makes sense (radar can cook things *fast*!), they have radio-controlled TV (same programs as we have, judging by the sound track in the scene where the FBI is watching TV). Because Scott tries hard to look at the future from the perspective of someone living in that future, what new technology is shown isn't explained. Why do people have radar dishes in their back yards? What is that TV-like screen one FBI man is studying? We never find out. It would have worked better as a sci-fi film if Scott had figured out a way to put the technolgy more in the spot-light.
The police do seem to have advanced slightly. They have flocks of helicopters, and the police cars have megaphones on them (again, nothing we couldn't do). On the other hand, the cops seem to have softened in 35 years; one policeman seems to care more about the two murderers he is chasing than he does the man they killed, and another is shown crying as soon as he is threatened. Are men supposed to be all soft crybabies or drooling apes in 1991?
Even weapons don't seem to have changed much. No blasters or ray guns for Mr. Scott. The women have a revolver and an automatic and the police have rifles. The rifles looked unfamiliar, but were never used, so I couldn't tell if they were any better than the rifles the army uses now. Again, there didn't seem to be any radical changes, just a lot more of what we have now.
THELMA AND LOUISE is a sci-fi film that suffers from a terrible lack of vision on Ridley Scott's part. His future is not much different from our present, except that it has more sex, funny looking cars, and a lot of helicopters. I had to agree with the despairing note the movie ends on; THELMA AND LOUISE is just a bleak, pornographic version of our present, with the slight advances in technology more than made up for by social decay. This is not a future I would want to live in.
James Nicoll
What, you think people posted reviews to USENET in 1956?
.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews