Turns {@link Jenkins#getSecretKey()} into an AES key.

@deprecated
This is no longer the key we use to encrypt new information, but we still need this
to be able to decrypt what's already persisted.
325364
@Deprecated
    /*package*/ static SecretKey getLegacyKey() throws GeneralSecurityException {
        String secret = Secret.SECRET;
        if(secret==null)    return Jenkins.getInstance().getSecretKeyAsAES128();
        return Util.toAes128Key(secret);
    }
781853
public com.google.api.ads.admanager.axis.v201811.ConversionEvent getKey() {
        return key;
    }
220426
public Key generateSharedKey() throws KeyException {
        javax.crypto.spec.SecretKeySpec sharedKey = null;
        try {
            if (crypto != null) {
                try {
                    sharedKey = new javax.crypto.spec.SecretKeySpec(AuditCrypto.generate3DESKey(), 0, 24, "DESede");
                } catch (Exception me) {
                    if (tc.isDebugEnabled())
                        Tr.debug(tc, "me.getMessage: " + me.getMessage());
                }
            }

            if (sharedKey != null) {
                return sharedKey;
            } else {
                throw new com.ibm.websphere.crypto.KeyException("Key could not be generated.");
            }

        } catch (Exception e) {
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Error generating key.", new Object[] { e });

            if (e instanceof KeyException)
                throw (KeyException) e;
            else
                throw new KeyException(e.getMessage(), e);
        }
    }
579591
protected String getEncryptionKey() {
        if (extendedMetadata != null && extendedMetadata.getEncryptionKey() != null) {
            return extendedMetadata.getEncryptionKey();
        } else {
            return keyManager.getDefaultCredentialName();
        }
    }
767108
private static void getKeyInfo(UResourceBundle keyInfoRes) {
        Set<String> _deprecatedKeys = new LinkedHashSet<String>();
        Map<String, ValueType> _valueTypes = new LinkedHashMap<String, ValueType>();
        for (UResourceBundleIterator keyInfoIt = keyInfoRes.getIterator(); keyInfoIt.hasNext();) {
            UResourceBundle keyInfoEntry = keyInfoIt.next();
            String key = keyInfoEntry.getKey();
            KeyInfoType keyInfo = KeyInfoType.valueOf(key);
            for (UResourceBundleIterator keyInfoIt2 = keyInfoEntry.getIterator(); keyInfoIt2.hasNext();) {
                UResourceBundle keyInfoEntry2 = keyInfoIt2.next();
                String key2 = keyInfoEntry2.getKey();
                String value2 = keyInfoEntry2.getString();
                switch (keyInfo) {
                case deprecated:
                    _deprecatedKeys.add(key2);
                    break;
                case valueType:
                    _valueTypes.put(key2, ValueType.valueOf(value2));
                    break;
                }
            }
        }
        DEPRECATED_KEYS = Collections.unmodifiableSet(_deprecatedKeys);
        VALUE_TYPES = Collections.unmodifiableMap(_valueTypes);
    }
339290
public byte[] decrypt(byte[] encrypted) throws AESException {
        try {
            SecretKeySpec skeySpec = new SecretKeySpec(secretKey, ENCRYPTION_ALGORITHM);
            Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM);
            cipher.init(Cipher.DECRYPT_MODE, skeySpec);
            return cipher.doFinal(encrypted);
        } catch (NoSuchAlgorithmException e) {
            throw new AESException(e);
        } catch (NoSuchPaddingException e) {
            throw new AESException(e);
        } catch (InvalidKeyException e) {
            throw new AESException(e);
        } catch (IllegalBlockSizeException e) {
            throw new AESException(e);
        } catch (BadPaddingException e) {
            throw new AESException(e);
        }
    }
614517
@Deprecated
  public static <K, V> Function<Map.Entry<K, V>, K> getEntryKey() {
    return entryKeyFunction();
  }
694621
public Key getKey()
    {
        final Key ret = new Key().setPersonId(getPersonId())
                        .setCompanyId(getCompanyId())
                        .setTypeId(getTypeId());
        return ret;
    }
1185744
@Deprecated
    public Cipher encrypt() {
        try {
            Cipher cipher = Secret.getCipher(KEY_ALGORITHM);
            cipher.init(Cipher.ENCRYPT_MODE, getKey());
            return cipher;
        } catch (GeneralSecurityException e) {
            throw new AssertionError(e);
        }
    }
941655
public String getKey(int key) {
		if (key == 0) 
			return Long.toString(this.getEvaluationIndex());
		else return Long.toString(10000
				* this.getEvaluationIndex()
				+ this.getClassifierIndex());
	}
79388
public static PrivateKey getSignCertPrivateKey() {
		try {
			Enumeration<String> aliasenum = keyStore.aliases();
			String keyAlias = null;
			if (aliasenum.hasMoreElements()) {
				keyAlias = aliasenum.nextElement();
			}
			PrivateKey privateKey = (PrivateKey) keyStore.getKey(keyAlias,
					SDKConfig.getConfig().getSignCertPwd().toCharArray());
			return privateKey;
		} catch (KeyStoreException e) {
			LogUtil.writeErrorLog("getSignCertPrivateKey Error", e);
			return null;
		} catch (UnrecoverableKeyException e) {
			LogUtil.writeErrorLog("getSignCertPrivateKey Error", e);
			return null;
		} catch (NoSuchAlgorithmException e) {
			LogUtil.writeErrorLog("getSignCertPrivateKey Error", e);
			return null;
		}
	}
112899
def EncryptPrivateKey(self, decrypted):
        
        aes = AES.new(self._master_key, AES.MODE_CBC, self._iv)
        return aes.encrypt(decrypted)
1025117
public static byte[] generateAesKey(int keysize) {
		try {
			KeyGenerator keyGenerator = KeyGenerator.getInstance(AES_ALG);
			keyGenerator.init(keysize);
			SecretKey secretKey = keyGenerator.generateKey();
			return secretKey.getEncoded();
		} catch (GeneralSecurityException e) {
			throw ExceptionUtil.unchecked(e);
		}
	}
367633
protected Tuple<SecretKey,byte[]> getSecretKeyFromAbove() {
        return (Tuple<SecretKey,byte[]>)up_prot.up(new Event(Event.GET_SECRET_KEY));
    }
665807
protected PGPSecretKey findSecretKey(InputStream secretKey, final long keyId) throws IOException, PGPException {
    LOGGER.trace("findSecretKey(InputStream, long)");
    LOGGER.trace("Secret Key: {}, Key ID: {}", secretKey == null ? "not set" : "set", keyId);
    return findSecretKey(secretKey, new KeyFilter<PGPSecretKey>() {
      @Override
      public boolean accept(PGPSecretKey secretKey) {
        return secretKey.getKeyID() == keyId;
      }
    });
  }
294960
public static InputStream decrypt(InputStream inputStream, byte[] key) {
        checkNotNull(inputStream);
        checkNotNull(key);
        AESFastEngine aesEngine = new AESFastEngine();
        PaddedBufferedBlockCipher cipher =
                new PaddedBufferedBlockCipher(aesEngine, new PKCS7Padding());
        cipher.init(false, new KeyParameter(key));
        return new CipherInputStream(inputStream, cipher);
    }
1066749
public String getKey(String key) {
        try {
            String _response = evCache.<String>get(key);
            return _response;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }