Lines Matching refs:key

47  *    is selected based on the en/decryption mode and public/private key used.
65 // mode constant for public key encryption
67 // mode constant for private key decryption
69 // mode constant for private key encryption (signing)
71 // mode constant for public key decryption (verifying)
90 // size of the output (the length of the key).
93 // the public key, if we were initialized using a public key
95 // the private key, if we were initialized using a private key
147 protected void engineInit(int opmode, Key key, SecureRandom random)
149 init(opmode, key);
153 protected void engineInit(int opmode, Key key,
161 init(opmode, key);
165 protected void engineInit(int opmode, Key key,
173 init(opmode, key);
177 private void init(int opmode, Key key) throws InvalidKeyException {
196 if (!(key instanceof sun.security.mscapi.Key)) {
197 if (key instanceof java.security.interfaces.RSAPublicKey) {
199 (java.security.interfaces.RSAPublicKey) key;
201 // Convert key to MSCAPI format
214 // Adjust key length due to sign bit
223 key = RSASignature.importPublicKey(keyBlob, keyBitLength);
230 throw new InvalidKeyException("Unsupported key type: " + key);
234 if (key instanceof PublicKey) {
236 publicKey = (sun.security.mscapi.Key)key;
239 } else if (key instanceof PrivateKey) {
241 privateKey = (sun.security.mscapi.Key)key;
245 throw new InvalidKeyException("Unknown key type: " + key);
340 protected byte[] engineWrap(Key key) throws InvalidKeyException,
342 byte[] encoded = key.getEncoded(); // TODO - unextractable key
344 throw new InvalidKeyException("Could not obtain encoded key");
381 throw new InvalidKeyException("Unknown key type " + type);
395 protected int engineGetKeySize(Key key) throws InvalidKeyException {
397 if (key instanceof sun.security.mscapi.Key) {
398 return ((sun.security.mscapi.Key) key).length();
400 } else if (key instanceof RSAKey) {
401 return ((RSAKey) key).getModulus().bitLength();
404 throw new InvalidKeyException("Unsupported key type: " + key);
408 // Construct an X.509 encoded public key.
424 throw new InvalidKeyException("Cannot construct public key", ike);
428 // Construct a PKCS #8 encoded private key.
444 throw new InvalidKeyException("Cannot construct private key", ike);
448 // Construct an encoded secret key.