core/src/main/java/com/orientechnologies/orient/core/security/symmetrickey/OSymmetricKey.java
public void saveToKeystore(final OutputStream os, final String ksPasswd, final String keyAlias, final String keyPasswd) {
    if (os == null)
      throw new OSecurityException("OSymmetricKey.saveToKeystore() OutputStream is null");
    if (ksPasswd == null)
      throw new OSecurityException("OSymmetricKey.saveToKeystore() Keystore Password is required");
    if (keyAlias == null)
      throw new OSecurityException("OSymmetricKey.saveToKeystore() Key Alias is required");
    if (keyPasswd == null)
      throw new OSecurityException("OSymmetricKey.saveToKeystore() Key Password is required");

    try {
      KeyStore ks = KeyStore.getInstance("JCEKS");

      char[] ksPasswdCA = ksPasswd.toCharArray();
      char[] keyPasswdCA = keyPasswd.toCharArray();

      // Create a new KeyStore by passing null.
      ks.load(null, ksPasswdCA);

      KeyStore.ProtectionParameter protParam = new KeyStore.PasswordProtection(keyPasswdCA);

      KeyStore.SecretKeyEntry skEntry = new KeyStore.SecretKeyEntry(secretKey);
      ks.setEntry(keyAlias, skEntry, protParam);

      // Save the KeyStore
      ks.store(os, ksPasswdCA);
    } catch (Exception ex) {
      throw OException.wrapException(new OSecurityException("OSymmetricKey.saveToKeystore() Exception: " + ex.getMessage()), ex);
    }
  }
public void saveToKeystore(final OutputStream os, final String ksPasswd, final String keyAlias, final String keyPasswd) {
    if (os == null)
      throw new OSecurityException("OSymmetricKey.saveToKeystore() OutputStream is null");
    if (ksPasswd == null)
      throw new OSecurityException("OSymmetricKey.saveToKeystore() Keystore Password is required");
    if (keyAlias == null)
      throw new OSecurityException("OSymmetricKey.saveToKeystore() Key Alias is required");
    if (keyPasswd == null)
      throw new OSecurityException("OSymmetricKey.saveToKeystore() Key Password is required");

    try {
      KeyStore ks = KeyStore.getInstance("JCEKS");

      char[] ksPasswdCA = ksPasswd.toCharArray();
      char[] keyPasswdCA = keyPasswd.toCharArray();

      // Create a new KeyStore by passing null.
      ks.load(null, ksPasswdCA);

      KeyStore.ProtectionParameter protParam = new KeyStore.PasswordProtection(keyPasswdCA);

      KeyStore.SecretKeyEntry skEntry = new KeyStore.SecretKeyEntry(secretKey);
      ks.setEntry(keyAlias, skEntry, protParam);

      // Save the KeyStore
      ks.store(os, ksPasswdCA);
    } catch (Exception ex) {
      throw OException.wrapException(new OSecurityException("OSymmetricKey.saveToKeystore() Exception: " + ex.getMessage()), ex);
    }
  }
Saves the internal SecretKey as a KeyStore.