/libcore/luni/src/main/java/javax/crypto/spec/ |
D | SecretKeySpec.java | 42 private final byte[] key; field in SecretKeySpec 57 public SecretKeySpec(byte[] key, String algorithm) { in SecretKeySpec() argument 58 if (key == null) { in SecretKeySpec() 61 if (key.length == 0) { in SecretKeySpec() 69 this.key = new byte[key.length]; in SecretKeySpec() 70 System.arraycopy(key, 0, this.key, 0, key.length); in SecretKeySpec() 93 public SecretKeySpec(byte[] key, int offset, int len, String algorithm) { in SecretKeySpec() argument 94 if (key == null) { in SecretKeySpec() 97 if (key.length == 0) { in SecretKeySpec() 103 if (key.length - offset < len) { in SecretKeySpec() [all …]
|
D | DESedeKeySpec.java | 33 private final byte[] key; field in DESedeKeySpec 46 public DESedeKeySpec(byte[] key) throws InvalidKeyException { in DESedeKeySpec() argument 47 if (key == null) { in DESedeKeySpec() 50 if (key.length < DES_EDE_KEY_LEN) { in DESedeKeySpec() 53 this.key = new byte[DES_EDE_KEY_LEN]; in DESedeKeySpec() 54 System.arraycopy(key, 0, this.key, 0, DES_EDE_KEY_LEN); in DESedeKeySpec() 72 public DESedeKeySpec(byte[] key, int offset) throws InvalidKeyException { in DESedeKeySpec() argument 73 if (key == null) { in DESedeKeySpec() 76 if (key.length - offset < DES_EDE_KEY_LEN) { in DESedeKeySpec() 79 this.key = new byte[DES_EDE_KEY_LEN]; in DESedeKeySpec() [all …]
|
D | DESKeySpec.java | 33 private final byte[] key; field in DESKeySpec 101 public DESKeySpec(byte[] key) throws InvalidKeyException { in DESKeySpec() argument 102 this(key, 0); in DESKeySpec() 117 public DESKeySpec(byte[] key, int offset) throws InvalidKeyException { in DESKeySpec() argument 118 if (key == null) { in DESKeySpec() 121 if (key.length - offset < DES_KEY_LEN) { in DESKeySpec() 124 this.key = new byte[DES_KEY_LEN]; in DESKeySpec() 125 System.arraycopy(key, offset, this.key, 0, DES_KEY_LEN); in DESKeySpec() 135 System.arraycopy(this.key, 0, result, 0, DES_KEY_LEN); in getKey() 153 public static boolean isParityAdjusted(byte[] key, int offset) throws InvalidKeyException { in isParityAdjusted() argument [all …]
|
/libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/spec/ |
D | SecretKeySpecTest.java | 44 byte[] key = new byte[] {1, 2, 3, 4, 5}; in testSecretKeySpec1() 62 new SecretKeySpec(key, null); in testSecretKeySpec1() 68 SecretKeySpec ks = new SecretKeySpec(key, algorithm); in testSecretKeySpec1() 69 key[0] ++; in testSecretKeySpec1() 72 key[0] == ks.getEncoded()[0]); in testSecretKeySpec1() 82 byte[] key = new byte[] {1, 2, 3, 4, 5}; in testSecretKeySpec2() 102 new SecretKeySpec(key, offset, len, null); in testSecretKeySpec2() 109 new SecretKeySpec(key, offset, key.length, algorithm); in testSecretKeySpec2() 116 new SecretKeySpec(key, 0, -1, algorithm); in testSecretKeySpec2() 124 SecretKeySpec ks = new SecretKeySpec(key, algorithm); in testSecretKeySpec2() [all …]
|
/libcore/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/ |
D | OpenSSLECKeyFactory.java | 70 protected <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec) in engineGetKeySpec() argument 72 if (key == null) { in engineGetKeySpec() 80 if (!"EC".equals(key.getAlgorithm())) { in engineGetKeySpec() 84 if (key instanceof ECPublicKey && ECPublicKeySpec.class.isAssignableFrom(keySpec)) { in engineGetKeySpec() 85 ECPublicKey ecKey = (ECPublicKey) key; in engineGetKeySpec() 87 } else if (key instanceof PublicKey && ECPublicKeySpec.class.isAssignableFrom(keySpec)) { in engineGetKeySpec() 88 final byte[] encoded = key.getEncoded(); in engineGetKeySpec() 89 if (!"X.509".equals(key.getFormat()) || encoded == null) { in engineGetKeySpec() 94 } else if (key instanceof ECPrivateKey in engineGetKeySpec() 96 ECPrivateKey ecKey = (ECPrivateKey) key; in engineGetKeySpec() [all …]
|
D | OpenSSLRSAKeyFactory.java | 72 protected <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec) in engineGetKeySpec() argument 74 if (key == null) { in engineGetKeySpec() 82 if (!"RSA".equals(key.getAlgorithm())) { in engineGetKeySpec() 86 if (key instanceof RSAPublicKey && RSAPublicKeySpec.class.isAssignableFrom(keySpec)) { in engineGetKeySpec() 87 RSAPublicKey rsaKey = (RSAPublicKey) key; in engineGetKeySpec() 89 } else if (key instanceof PublicKey && RSAPublicKeySpec.class.isAssignableFrom(keySpec)) { in engineGetKeySpec() 90 final byte[] encoded = key.getEncoded(); in engineGetKeySpec() 91 if (!"X.509".equals(key.getFormat()) || encoded == null) { in engineGetKeySpec() 97 } else if (key instanceof RSAPrivateCrtKey in engineGetKeySpec() 99 RSAPrivateCrtKey rsaKey = (RSAPrivateCrtKey) key; in engineGetKeySpec() [all …]
|
D | OpenSSLDSAKeyFactory.java | 69 protected <T extends KeySpec> T engineGetKeySpec(Key key, Class<T> keySpec) in engineGetKeySpec() argument 71 if (key == null) { in engineGetKeySpec() 79 if (!"DSA".equals(key.getAlgorithm())) { in engineGetKeySpec() 83 if (key instanceof DSAPublicKey && DSAPublicKeySpec.class.isAssignableFrom(keySpec)) { in engineGetKeySpec() 84 DSAPublicKey dsaKey = (DSAPublicKey) key; in engineGetKeySpec() 88 } else if (key instanceof PublicKey && DSAPublicKeySpec.class.isAssignableFrom(keySpec)) { in engineGetKeySpec() 89 final byte[] encoded = key.getEncoded(); in engineGetKeySpec() 90 if (!"X.509".equals(key.getFormat()) || encoded == null) { in engineGetKeySpec() 98 } else if (key instanceof DSAPrivateKey in engineGetKeySpec() 100 DSAPrivateKey dsaKey = (DSAPrivateKey) key; in engineGetKeySpec() [all …]
|
D | OpenSSLSecretKey.java | 35 private transient OpenSSLKey key; field in OpenSSLSecretKey 42 key = new OpenSSLKey(NativeCrypto.EVP_PKEY_new_mac_key(type, encoded)); in OpenSSLSecretKey() 45 public OpenSSLSecretKey(String algorithm, OpenSSLKey key) { in OpenSSLSecretKey() argument 47 this.key = key; in OpenSSLSecretKey() 49 type = NativeCrypto.EVP_PKEY_type(key.getPkeyContext()); in OpenSSLSecretKey() 53 public static OpenSSLKey getInstance(SecretKey key) throws InvalidKeyException { in getInstance() argument 56 key.getEncoded())); in getInstance() 69 if (key.isEngineBased()) { in getFormat() 78 if (key.isEngineBased()) { in getEncoded() 87 return key; in getOpenSSLKey() [all …]
|
D | OpenSSLECPrivateKey.java | 37 protected transient OpenSSLKey key; field in OpenSSLECPrivateKey 41 public OpenSSLECPrivateKey(OpenSSLECGroupContext group, OpenSSLKey key) { in OpenSSLECPrivateKey() argument 43 this.key = key; in OpenSSLECPrivateKey() 46 public OpenSSLECPrivateKey(OpenSSLKey key) { in OpenSSLECPrivateKey() argument 47 final long origGroup = NativeCrypto.EC_KEY_get0_group(key.getPkeyContext()); in OpenSSLECPrivateKey() 49 this.key = key; in OpenSSLECPrivateKey() 56 key = new OpenSSLKey(NativeCrypto.EVP_PKEY_new_EC_KEY(group.getContext(), 0, in OpenSSLECPrivateKey() 87 return NativeCrypto.i2d_PKCS8_PRIV_KEY_INFO(key.getPkeyContext()); in getEncoded() 97 if (key.isEngineBased()) { in getS() 105 return new BigInteger(NativeCrypto.EC_KEY_get_private_key(key.getPkeyContext())); in getPrivateKey() [all …]
|
D | OpenSSLRSAPrivateKey.java | 32 protected transient OpenSSLKey key; field in OpenSSLRSAPrivateKey 40 OpenSSLRSAPrivateKey(OpenSSLKey key) { in OpenSSLRSAPrivateKey() argument 41 this.key = key; in OpenSSLRSAPrivateKey() 44 OpenSSLRSAPrivateKey(OpenSSLKey key, byte[][] params) { in OpenSSLRSAPrivateKey() argument 45 this(key); in OpenSSLRSAPrivateKey() 52 return key; in getOpenSSLKey() 84 static OpenSSLRSAPrivateKey getInstance(OpenSSLKey key) { in getInstance() argument 85 byte[][] params = NativeCrypto.get_RSA_private_params(key.getPkeyContext()); in getInstance() 87 return new OpenSSLRSAPrivateCrtKey(key, params); in getInstance() 89 return new OpenSSLRSAPrivateKey(key, params); in getInstance() [all …]
|
D | OpenSSLECPublicKey.java | 38 protected transient OpenSSLKey key; field in OpenSSLECPublicKey 42 public OpenSSLECPublicKey(OpenSSLECGroupContext group, OpenSSLKey key) { in OpenSSLECPublicKey() argument 44 this.key = key; in OpenSSLECPublicKey() 47 public OpenSSLECPublicKey(OpenSSLKey key) { in OpenSSLECPublicKey() argument 48 final long origGroup = NativeCrypto.EC_KEY_get0_group(key.getPkeyContext()); in OpenSSLECPublicKey() 50 this.key = key; in OpenSSLECPublicKey() 58 key = new OpenSSLKey(NativeCrypto.EVP_PKEY_new_EC_KEY(group.getContext(), in OpenSSLECPublicKey() 90 return NativeCrypto.i2d_PUBKEY(key.getPkeyContext()); in getEncoded() 100 NativeCrypto.EC_KEY_get_public_key(key.getPkeyContext())); in getPublicKey() 112 return key; in getOpenSSLKey() [all …]
|
D | OpenSSLCipherRSA.java | 49 private OpenSSLKey key; field in OpenSSLCipherRSA 137 if (key == null) { in keySizeBytes() 140 return NativeCrypto.RSA_size(this.key.getPkeyContext()); in keySizeBytes() 153 private void engineInitInternal(int opmode, Key key) throws InvalidKeyException { in engineInitInternal() argument 162 if (key instanceof OpenSSLRSAPrivateKey) { in engineInitInternal() 163 OpenSSLRSAPrivateKey rsaPrivateKey = (OpenSSLRSAPrivateKey) key; in engineInitInternal() 165 this.key = rsaPrivateKey.getOpenSSLKey(); in engineInitInternal() 166 } else if (key instanceof RSAPrivateCrtKey) { in engineInitInternal() 167 RSAPrivateCrtKey rsaPrivateKey = (RSAPrivateCrtKey) key; in engineInitInternal() 169 this.key = OpenSSLRSAPrivateCrtKey.getInstance(rsaPrivateKey); in engineInitInternal() [all …]
|
D | OpenSSLECDHKeyAgreement.java | 51 public Key engineDoPhase(Key key, boolean lastPhase) throws InvalidKeyException { in engineDoPhase() argument 59 if (key == null) { in engineDoPhase() 62 if (!(key instanceof PublicKey)) { in engineDoPhase() 63 throw new InvalidKeyException("Not a public key: " + key.getClass()); in engineDoPhase() 65 OpenSSLKey openSslPublicKey = translateKeyToEcOpenSSLKey(key); in engineDoPhase() 120 protected void engineInit(Key key, SecureRandom random) throws InvalidKeyException { in engineInit() argument 121 if (key == null) { in engineInit() 124 if (!(key instanceof PrivateKey)) { in engineInit() 125 throw new InvalidKeyException("Not a private key: " + key.getClass()); in engineInit() 128 OpenSSLKey openSslKey = translateKeyToEcOpenSSLKey(key); in engineInit() [all …]
|
/libcore/luni/src/main/java/java/nio/channels/spi/ |
D | AbstractSelectableChannel.java | 91 for (SelectionKey key : keyList) { in keyFor() 92 if (key != null && key.selector() == selector) { in keyFor() 93 return key; in keyFor() 148 SelectionKey key = keyFor(selector); in register() local 149 if (key == null) { in register() 150 key = ((AbstractSelector) selector).register(this, interestSet, attachment); in register() 151 keyList.add(key); in register() 153 if (!key.isValid()) { in register() 156 key.interestOps(interestSet); in register() 157 key.attach(attachment); in register() [all …]
|
/libcore/luni/src/main/java/libcore/util/ |
D | BasicLruCache.java | 44 public synchronized final V get(K key) { in get() argument 45 if (key == null) { in get() 49 V result = map.get(key); in get() 54 result = create(key); in get() 57 map.put(key, result); in get() 70 public synchronized final V put(K key, V value) { in put() argument 71 if (key == null) { in put() 77 V previous = map.put(key, value); in put() 86 K key = toEvict.getKey(); in trimToSize() local 88 map.remove(key); in trimToSize() [all …]
|
/libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/ |
D | ExemptionMechanismSpiTest.java | 66 protected void engineInit(Key key) throws InvalidKeyException, ExemptionMechanismException { in engineInit() argument 67 super.engineInit(key); in engineInit() 72 …protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, Inva… in engineInit() argument 73 super.engineInit(key, params); in engineInit() 78 …protected void engineInit(Key key, AlgorithmParameters params) throws InvalidKeyException, Invalid… in engineInit() argument 79 super.engineInit(key, params); in engineInit() 98 Key key = null; in testExemptionMechanismSpi01() local 102 emSpi.engineInit(key); in testExemptionMechanismSpi01() 107 emSpi.engineInit(key, params); in testExemptionMechanismSpi01() 112 emSpi.engineInit(key, parSpec); in testExemptionMechanismSpi01() [all …]
|
/libcore/luni/src/main/java/org/apache/harmony/security/ |
D | SystemScope.java | 90 public synchronized Identity getIdentity(PublicKey key) { in getIdentity() argument 91 if (key == null) { in getIdentity() 94 return (Identity) keys.get(key); in getIdentity() 110 PublicKey key = identity.getPublicKey(); in addIdentity() local 111 if (key != null && keys.containsKey(key)) { in addIdentity() 112 throw new KeyManagementException("key '" + key + "' is already used"); in addIdentity() 116 if (key != null) { in addIdentity() 117 keys.put(key, identity); in addIdentity() 140 PublicKey key = identity.getPublicKey(); in removeIdentity() local 142 if (key != null) { in removeIdentity() [all …]
|
/libcore/luni/src/test/java/tests/security/interfaces/ |
D | RSAPrivateCrtKeyTest.java | 25 RSAPrivateCrtKey key = null; field in RSAPrivateCrtKeyTest 30 key = (RSAPrivateCrtKey) gen.generatePrivate(Util.rsaCrtParam); in setUp() 39 Util.rsaCrtParam.getCrtCoefficient(), key.getCrtCoefficient()); in test_getCrtCoefficient() 48 Util.rsaCrtParam.getPrimeExponentP(), key.getPrimeExponentP()); in test_getPrimeExponentP() 57 Util.rsaCrtParam.getPrimeExponentQ(), key.getPrimeExponentQ()); in test_getPrimeExponentQ() 66 Util.rsaCrtParam.getPrimeP(), key.getPrimeP()); in test_getPrimeP() 75 Util.rsaCrtParam.getPrimeQ(), key.getPrimeQ()); in test_getPrimeQ() 84 Util.rsaCrtParam.getPublicExponent(), key.getPublicExponent()); in test_getPublicExponent() 88 key = null; in tearDown()
|
/libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/interfaces/ |
D | PBEKeyTest.java | 43 checkPBEKey key = new checkPBEKey(); in testField() local 45 key.getSerVerUID(), //PBEKey.serialVersionUID in testField() 50 checkPBEKey key = new checkPBEKey(); in test_getIterationCount() local 52 key.getIterationCount(); in test_getIterationCount() 56 checkPBEKey key = new checkPBEKey(); in test_getPassword() local 58 key.getPassword(); in test_getPassword() 62 checkPBEKey key = new checkPBEKey(); in test_getSalt() local 64 key.getSalt(); in test_getSalt()
|
/libcore/luni/src/main/java/java/io/ |
D | SerializationHandleMap.java | 53 Object key = oldKeys[i]; in resizeArrays() local 55 int index = findIndex(key, keys); in resizeArrays() 56 keys[index] = key; in resizeArrays() 62 public int get(Object key) { in get() argument 63 int index = findIndex(key, keys); in get() 64 if (keys[index] == key) { in get() 74 private int findIndex(Object key, Object[] array) { in findIndex() argument 76 int index = getModuloHash(key, length); in findIndex() 79 if (array[index] == key || array[index] == null) { in findIndex() 91 private int getModuloHash(Object key, int length) { in getModuloHash() argument [all …]
|
/libcore/luni/src/main/java/java/util/prefs/ |
D | Preferences.java | 244 public abstract String get(String key, String deflt); in get() argument 272 public abstract boolean getBoolean(String key, boolean deflt); in getBoolean() argument 301 public abstract byte[] getByteArray(String key, byte[] deflt); in getByteArray() argument 329 public abstract double getDouble(String key, double deflt); in getDouble() argument 358 public abstract float getFloat(String key, float deflt); in getFloat() argument 387 public abstract int getInt(String key, int deflt); in getInt() argument 415 public abstract long getLong(String key, long deflt); in getLong() argument 550 public abstract void put(String key, String value); in put() argument 569 public abstract void putBoolean(String key, boolean value); in putBoolean() argument 594 public abstract void putByteArray(String key, byte[] value); in putByteArray() argument [all …]
|
/libcore/luni/src/main/java/java/util/ |
D | AbstractMap.java | 52 private final K key; field in AbstractMap.SimpleImmutableEntry 56 key = theKey; in SimpleImmutableEntry() 64 key = copyFrom.getKey(); in SimpleImmutableEntry() 69 return key; in getKey() 90 return (key == null ? entry.getKey() == null : key.equals(entry in equals() 99 return (key == null ? 0 : key.hashCode()) in hashCode() 104 return key + "=" + value; in toString() 117 private final K key; field in AbstractMap.SimpleEntry 121 key = theKey; in SimpleEntry() 129 key = copyFrom.getKey(); in SimpleEntry() [all …]
|
D | MapEntry.java | 25 K key; field in MapEntry 33 key = theKey; in MapEntry() 37 key = theKey; in MapEntry() 57 return (key == null ? entry.getKey() == null : key.equals(entry in equals() 66 return key; in getKey() 75 return (key == null ? 0 : key.hashCode()) in hashCode() 87 return key + "=" + value; in toString()
|
D | IdentityHashMap.java | 105 return (key == entry.getKey()) && (value == entry.getValue()); in equals() 112 return System.identityHashCode(key) in hashCode() 118 return key + "=" + value; in toString() 124 map.put(key, object); in setValue() 336 public boolean containsKey(Object key) { 337 if (key == null) { 338 key = NULL_OBJECT; 341 int index = findIndex(key, elementData); 342 return elementData[index] == key; 375 public V get(Object key) { [all …]
|
/libcore/luni/src/main/java/java/lang/ |
D | ThreadLocal.java | 218 InheritableThreadLocal key = reference.get(); in inheritValues() local 219 if (key != null) { in inheritValues() 223 table[i + 1] = key.childValue(fromParent.table[i + 1]); in inheritValues() 347 ThreadLocal<?> key = reference.get(); in rehash() local 348 if (key != null) { in rehash() 350 add(key, oldTable[i + 1]); in rehash() 365 void add(ThreadLocal<?> key, Object value) { in add() argument 366 for (int index = key.hash & mask;; index = next(index)) { in add() 369 table[index] = key.reference; in add() 380 void put(ThreadLocal<?> key, Object value) { in put() argument [all …]
|