core/src/main/java/com/orientechnologies/orient/core/security/symmetrickey/OSymmetricKey.java
public void saveToStream(final OutputStream os) {
    if (os == null)
      throw new OSecurityException("OSymmetricKey.saveToStream() OutputStream is null");

    try {
      final OutputStreamWriter osw = new OutputStreamWriter(os);
      try {
        final BufferedWriter writer = new BufferedWriter(osw);
        try {
          writer.write(getBase64Key());
        } finally {
          writer.close();
        }
      } finally {
        os.close();
      }
    } catch (Exception ex) {
      throw OException.wrapException(new OSecurityException("OSymmetricKey.saveToStream() Exception: " + ex.getMessage()), ex);
    }
  }
public void saveToStream(final OutputStream os) {
    if (os == null)
      throw new OSecurityException("OSymmetricKey.saveToStream() OutputStream is null");

    try {
      final OutputStreamWriter osw = new OutputStreamWriter(os);
      try {
        final BufferedWriter writer = new BufferedWriter(osw);
        try {
          writer.write(getBase64Key());
        } finally {
          writer.close();
        }
      } finally {
        os.close();
      }
    } catch (Exception ex) {
      throw OException.wrapException(new OSecurityException("OSymmetricKey.saveToStream() Exception: " + ex.getMessage()), ex);
    }
  }
Saves the internal SecretKey to the specified OutputStream as a Base64 String.