検索

質問
· 2024年5月16日

RSA Encryption Decryption

Hi guys,

 

I try to make a test of encryption, decryption of a simple text.

I can crypt my text, but I can't decrypt it, do you see somewhere a dummy error of my part ?

Thanks for help

ClassMethod UnitTest()

{

  set inputPlainText = "David"

 

  // get private key

  set privKeyFileName = "C:\temp\toto.pem"

  set privobjCharFile = ##class(%Stream.FileCharacter).%New()

  set privobjCharFile.Filename = privKeyFileName

  set privKey = privobjCharFile.Read()

 

  set Inputbase64 = $SYSTEM.Encryption.Base64Encode(inputPlainText)

 

  // encrypte text using RSA

  set encryptText = $System.Encryption.RSAEncrypt(Inputbase64, privKey)

 

  // decrypt text using RSA

  set outputbase64 = $System.Encryption.RSADecrypt(encryptText, privKey)

 

  set plaintext = $SYSTEM.Encryption.Base64Decode(outputbase64)

 

  return plaintext

}

2 Comments
ディスカッション (2)1
続けるにはログインするか新規登録を行ってください
記事
· 2024年5月16日 9m read

インターシステムズ製品をバックアップする前に確認したいこと

開発者の皆さん、こんにちは。

この記事では、InterSystems製品のバックアップ方法(4種類)のご紹介と、バックアップを行う前に確認しておきたい内容について解説します。

また、この記事に続くシリーズ記事では、それぞれのバックアップの仕組みと操作例を交えたバックアップとリストア手順を解説していきます。

シリーズ記事の中で行っているバックアップ練習、リストア練習の内容については、インターシステムズの講師付きトレーニングコースの中でも取り入れている内容で、一人1環境の演習環境内で実際にお試しいただいています。

参加者の皆さんと一緒に演習を進めて行きますと、データベースリストアの後に行うジャーナルリストアについては、ユーティリティから出力される確認項目が多いため、皆さん慎重に確認されながらリストアの指示を入力されています。そのため、リストア開始前の手続きや準備に意外と時間がかかっています。(実行例

普段なかなかバックアップやリストアを行う機会がないかと思いますが、万が一の場合に備え練習いただくことで実際のリストア作業が発生した際も落ち着いて対処できるようになるかと思います。

また、試さなくてもどんな感じになるのかをお読みいただくことで手続きの大枠がつかめ、心の準備ができるかと思います。まだ体験されたことない方はぜひご興味あるバックアップ手法に対するバックアップ・リストア方法をご確認下さい!


最初は、バックアップの種類について簡単にご紹介します。

 

InterSystems製品のバックアップ方法(4種類)

以下の4種類の方法を選択できます。

推奨方法) 外部バックアップは主に、論理ディスク・ボリュームの有効な ”スナップショット” を迅速に作成するテクノロジと共に使用します。 ここでは、バックアップ時、データベースへの書き込みをフリーズさせてからスナップショットを実行します。

この ”スナップショット” のようなテクノロジは、ストレージアレイからオペレーティング・システム、ディスクの単純なミラーリングに至るまで、さまざまなレベルで存在します。

InterSystems製品が用意するバックアップ機能を利用する方法で、バックアップ対象に設定した全データベースの使用済ブロックをバックアップする方法です。

管理ポータルメニューやタスクスケジュールにも含まれるメニューでお手軽ですが、データベースの使用済ブロック数が多くなればなるほどバックアップ時間も長くなりバックアップファイルサイズも大きくなってしまう方法です。

バージョン2024.1以降では、実験的機能としてオンラインバックアップの高速化機能を提供しています。

データベースファイル(DATファイル)の退避(ファイルコピーのような対退避方法も含)とオンライン・バックアップを組み合わせて利用する方法で、外部バックアップで使用するスナップショットのようなテクノロジが利用できない環境に対して素早くバックアップを取得できる方法です。(オンラインバックアップより高速にバックアップを実行できますが、手順は複雑です。)

InterSystems製品を停止できる場合に利用できる方法で手順がシンプルです。

 

シリーズ記事では、それぞれのバックアップ方法とリストア方法を解説していきますがその前に、 バックアップを取得する前に必ず確認しておきたい事 があります。

さて、それは何でしょうか・・・・・

 

👇

👇

それは、バックアップを取るデータベースの物理的な整合性が保たれているかどうかをバックアップ前に確認すること です。

万が一に備えてバックアップをとっていたとしても、バックアップ対象データベースの物理的な整合性が崩れている状態のバックアップはリストア対象として利用できません。

物理的な整合性=ディスク上のデータベース・ブロックの整合性

整合性が崩れた状態で取得したバックアップでは、正常な状態のデータベースに復旧させることができないためデータ喪失につながり、バックアップの目的が果たせず、非常に危険です。

バックアップが正常に成功していることを確認することも重要ですが、最も重要なことは データベースの整合性が保たれているデータベースをバックアップしているか ということです。

種類別のバックアップ方法、リストア方法紹介の前に、まずはデータベースの整合性チェックについて確認していきましょう。

 

データベースの物理的な整合性チェックツール

整合性チェックは、管理ポータルメニュー([システムオペレーション] > [データベース] > [整合性チェック]ボタン)や ^Integrity 、タスクスケジュールを使用して実行することができます。

管理ポータルメニューは以下の通りです。

システムルーチン:^Integrity を使用する場合は、IRISにログインし%SYSネームスペースに移動します。

チェックしたいデータベースを指定した実行もできますが、まずはシステム全体のチェックを実行してみます。

カレントデバイスに出力することもできますが、整合性チェックのログは長くなるので、例ではファイル出力先をフルパスで指定しています。

USER>set $namespace="%SYS"
%SYS>do ^Integrity
This utility is used to check the integrity of a database
and the pointer structure of one or more globals.

Output results on
Device: /usr/irissys/mgr/integ0424.log
Parameters? "WNS" =>
Stop after any error?  No=>
Do you want to check all databases?  No=> yes

ログ例は以下の通りです。

整合性チェックは全てのデータベースブロックについての検査結果を出力する長いログのため、一部省略+コメントを追記しています。

Intersystems IRIS Database Integrity Check on 04/08/2024 at 15:23:20
System: 733fea287670  Configuration: IRIS
IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2024.1 (Build 263U) Wed Mar 13 2024 15:21:28 EDT


《コメント》データベースディレクトリ毎に中身に含まれるデータベースブロックのつながりを検査します。

---Directory /usr/irissys/mgr/---

Global: %
 トップ/ボトムポインタレベル: ブロック数=1      8kb (充填率 0%)
 データレベル:           ブロック数=2      16kb (充填率 79%)
 合計:                ブロック数=3      24kb (充填率 53%)
 経過時間 = 0.204/08/2024 15:23:26
Global: %IRIS.SASchema
 トップ/ボトムポインタレベル: ブロック数=1      8kb (充填率 0%)
 データレベル:           ブロック数=1      8kb (充填率 11%)
 合計:                ブロック数=2      16kb (充填率 5%)
 経過時間 = 0.204/08/2024 15:23:26
<省略>

Global: rOBJ
 トップ/ボトムポインタレベル: ブロック数=1      8kb (充填率 37%)
 データレベル:           ブロック数=205      1,640kb (充填率 73%)
 ビッグストリング:          ブロック数=1,374      10MB (充填率 81%) カウント = 539
 合計:                ブロック数=1,580      12MB (充填率 80%)
 経過時間 = 0.204/08/2024 15:23:40
---Total for directory /usr/irissys/mgr/---
        95 Pointer Level blocks         760kb (16% full)
     6,634 Data Level blocks             51MB (83% full)
     1,574 Big String blocks             12MB (79% full) # = 696
     8,318 Total blocks                  64MB (81% full)
     1,279 Free blocks                10232kb

Elapsed time = 14.3 seconds 04/08/2024 15:23:40
《コメント》データベースディレクトリに対してチェックが終わると上記サマリを出力し、エラーがない場合は以下出力します。

No Errors were found in this directory.


《コメント》次のデータベースに対する整合性チェックを開始します。

---Directory /usr/irissys/mgr/HSCUSTOM/---

Global: EnsDICOM.Dictionary
 トップ/ボトムポインタレベル: ブロック数=1      8kb (充填率 0%)
 データレベル:           ブロック数=1      8kb (充填率 0%)
 合計:                ブロック数=2      16kb (充填率 0%)
 経過時間 = 0.204/08/2024 15:23:40
<省略>

Global: rOBJ
 トップ/ボトムポインタレベル: ブロック数=1      8kb (充填率 2%)
 データレベル:           ブロック数=19      152kb (充填率 76%)
 ビッグストリング:          ブロック数=259      2,072kb (充填率 60%) カウント = 259
 合計:                ブロック数=279      2,232kb (充填率 61%)
 経過時間 = 0.104/08/2024 15:23:47
---Total for directory /usr/irissys/mgr/HSCUSTOM/---
        48 Pointer Level blocks         384kb (11% full)
     2,150 Data Level blocks             16MB (70% full)
       272 Big String blocks           2176kb (60% full) # = 272
     2,485 Total blocks                  19MB (67% full)
       203 Free blocks                 1624kb

Elapsed time = 7.6 seconds 04/08/2024 15:23:47
No Errors were found in this directory.

《コメント》以降同様にデータベース毎にチェックを行い、エラーがある場合はその対象ブロックに対してエラー情報を出力します。エラーがない場合は各データベースのチェックの終わりに「No Errors were found in this directory.」と出力します。

すべてのデータベースの検査を終え、エラーがない事を確認すると以下1行出力し、整合性チェックが終了します。

No Errors were found.

 

タスクスケジュールについては、インストール時に毎週月曜日深夜2時に実行するタスクとして登録されていますが、一時停止状態で登録されています。

管理ポータル > [システムオペレーション] > [タスクマネージャ] > [タスクスケジュール] > Integrity Check 

整合性チェックは指定したデータベースの全データベースブロックを検査するため、チェック時間は、データ量、チェックするデータベース数、HWスペックに依存します。

目安となるような計測時間は特になく、実際稼働中の環境で実測した値を参考に予測していただく必要があります。

万が一の場合に備え、データベース整合性チェック時間のおおよその検討が付けられるように、実環境でテスト実行を行っていただくことを推奨します。

また、整合性チェック時間は環境により異なりますので、実稼働環境の状況に合わせ実行のタイミングをご検討ください。

もし、整合性チェックでエラーが出た場合は、すぐにサポートセンターまでご連絡ください。

 

以上、整合性チェックツールの使い方でした。

次は、いよいよバックアップ種類別のバックアップとリストア方法について解説します。

​​​​​​

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
InterSystems公式
· 2024年5月15日 2m read

InterSystems 製品 2024.1.0.267.2 リリースのご案内 (Ubuntu 24.04 サポート他)

インターシステムズは、InterSystems IRIS データ・プラットフォーム、InterSystems IRIS for Health 、HealthShare Health Connect のバージョン 2024.1.0.267.2 をリリースしました。
 

このリリースには、Ubuntu 24.04 オペレーティング・システムのサポートが追加されています。 Ubuntu 24.04 には、Linux カーネル 6.8、セキュリティの改善、インストーラおよびユーザ・インタフェースの改善が含まれています。 InterSystems IRIS IntegratedML は、Ubuntu 24.04 ではまだご利用いただけません。
 

さらにこのリリースでは、すべてのプラットフォームで以下の2つの不具合が修正されています:

  • "NOT %INLIST" を使用した SQL クエリが不正な結果を返す問題を修正しました。以前、このエラーに関する警告 を発行しました。
  • 特定の状況で不完全なスタック・トレースが発生する問題を修正しました。


ソフトウェアの入手方法

通常、拡張メンテナンス(EM)リリースには、サポートされているすべてのプラットフォーム用のクラシックインストールパッケージと、Dockerコンテナ形式のコンテナイメージがあります。サポートされるプラットフォームのリストについては サポートプラットフォーム一覧(英語) を参照してください。
 

インストーラパッケージ

各製品のインストーラパッケージは WRC Directの 製品ダウンロードページ から入手できます。評価サービス のサイトからもキットを入手できます。
 

コンテナイメージ

InterSystems IRIS、IRIS for Health および関連コンポーネントのエンタープライズエディション、コミュニティエディションのコンテナイメージはInterSystems コンテナレジストリ(ICR) のウェブインターフェースから入手できます。

コンテナには、「2024.1」 または 「latest-em」 のタグが付けられています。

ディスカッション (0)0
続けるにはログインするか新規登録を行ってください
質問
· 2024年5月15日

Modification d'un objet dynamique provenant d'un JSON

Bonjour, 

Je souhaite réaliser une méthode générique pour modifier des propriétés d'une classe dynamique. Lorsque je fais un JSONImport() cela fonctionne très bien pour certains objet, or dans le cas d'un objet contenant une liste cela m'ajoute un élément en plus au lieu de la modifier. J'ai essayée de vérifier le type lors de l'itération du JSON afin de faire un Insert mais je n'arrive pas à utiliser les $METHOD sur le Insert ou même le %Set. 

Voici la classe : 

Class Epc.conf.poste Extends (%Persistent, %JSON.Adaptor)
{

Property NomPoste As %String(%JSONFIELDNAME = "NomPoste", MAXLEN = "");
Property tPrinter As list Of EpErp.conf.printer(%JSONFIELDNAME = "tPrinter", SQLPROJECTION = "table/column", STORAGEDEFAULT = "array");
}
Class EpErp.conf.printer Extends (%SerialObject, %JSON.Adaptor)
{

Property Service As %String(%JSONFIELDNAME = "NomService", MAXLEN = "");
Property Print As %String(%JSONFIELDNAME = "NomImprimante", MAXLEN = "");
}

Mes données actuelles : 

Le fichier que j'envoie afin de modifier ma liste, je souhaite donc modifier un des éléments de ma list  : 

{
	"NomPoste":"Poste",
	"tPrinter":
	[
		{
			"NomService":"Petite",
			"NomImprimante":"EPFR_12"
		},
		{
			"NomService":"Grande",
			"NomImprimante":"Modif"
		}
	]
}

Ma méthode de modification générique : 

ClassMethod update(){
    
set payload={}.%FromJSON(%request.Content)

 set itr           = payload.%GetIterator()  

 if ##class(%Dictionary.ClassDefinition).%ExistsId(className){
  set class = $CLASSMETHOD(className,"%OpenId",id)
   if $ISOBJECT(class){
       if payload '= ""{
          while itr.%GetNext(.prop,.val) {
              if prop.%IsA("%DynamicArray"){
                    ?                 
                }else{
                    Set $PROPERTY(class, prop) = val
                }
               
                  do class.%Save()
                 }
             }
        }
     }
}

Merci par avance pour votre aide. 

2 Comments
ディスカッション (2)2
続けるにはログインするか新規登録を行ってください
記事
· 2024年5月15日 4m read

Vector search + GenAI + InterSystems technologies with Banksia Global

 

Hi all! Here I would like to share how we use vector search and GenAI with InterSystems technology. As an example, I'll describe BG-AppealAI project, which our company submitted to the InterSystems Vector Search, GenAI and ML Contest. BG-AppealAI application can write an appeal if you upload an insurance contract and the insurance company’s letter with a refusal to pay medical expenses. Of course, we are aware that at the moment AI has not reached such a level as to create ready-made legal documents. However, it's already possible to create tools to serve as assistants for specialists or ordinary users. Likewise, our application is an AI assistant that answers the question: "Is an appeal possible?" and creates a draft letter of appeal, if possible. 

Explore our application in action by following this link: https://appealai.cloud.banksia.global/#/welcome

We've also created a video showcasing our app: https://www.youtube.com/embed/0p6FvZpzaaA

How BG-AppealAI works

Insurance contracts and rejection letters vectorization: to be able to better assist with appeals, AI needs a context of the denial. One of the possible ways we can provide a context is by citing relevant parts of insurance contracts. Upon receiving an insurance contract, BG-AppealAI breaks it down into parts, converting each part into a multi-dimensional vector. These vectors are stored in an InterSystems IRIS database, allowing fast and accurate retrieval when needed. 

Vector Search:  when you upload a rejection letter to the app, BG-AppealAI converts it to the vector, this is called the vectorization process.  BG-AppealAI then uses IRIS vector search functionality to compare vectors extracted from the rejection letter with vectors extracted from the relevant insurance contract.

AI-Powered Appeal Generation: having identified potential context for appeal, BG-AppealAI sends a request to the generative AI service to assess the possibility of drafting an appeal. If it is deemed appropriate, AppealAI sends a new request in order to create a draft letter of appeal.

 

What's under the hood of the BG-AppealAI

Traditionally, our application consists of backend and frontend parts, where the frontend is developed on Angular framework and the backend on InterSystems IRIS. The video about our application has already shown the work of the frontend part of the application and a brief overview of the product, here I want to focus on the implementation of Interoperability Production. This is where we can clearly see the application of vector search and generative AI. 

So, there are the following elements in our system:
1) ConversionToVector - process that converts document text into vectors using LangChain, and invokes process GetText and operations SaveVector, SaveDocument for the corresponding actions.

 

2) GetText - process that parses data from a file into a stream, for further text processing and analysis. Here there is opportunity to work with 2 types of extensions: docx and pdf, as the most common ones for documents. 

 

3) VectorSearch - process that performs a vector search and looks for matches between documents. Also, it is in this business process that methods are called to write promts to the AI and analyze rejection letters. 

 

Note, that here we used a language model developed by OpenAI and the LangChain framework. All business processes are implemented using embedded python as it provides easy access to utilization to use LangChain and write promts to OpenAI.
4) AppealIn - service that receives the rejection file and sends it for analysis.
5) DocumentIn - service that receives the insurance contract file and sends it for vectorization.
6) OpenAiOut - operation that makes a request to a generative AI - OpenAI, receives promt, returns a response from GenAI.
7) SaveDocument - operation that stores the document file in the database.
8) SaveVector - operation that stores vectors in the database.
9) SaveAppeal - operation that gets the text of the appeal and stores it in the database.

The interaction of all the above elements is well shown by the visual trace. Visual trace of taking an insurance contract, dividing it into vectors, and storing the vectors in a database:

 

Visual trace of receiving a rejection letter, sending requests to OpenAI, and saving the appeal letter if an appeal is possible:

 

This is an example of a rejection letter:

 

This is an example of an appeal written by BG-AppealAI:

 

We hope that our open source project will be useful to this community and help you implement innovative technologies in your projects. Our team would like to thank InterSystems for the opportunity to work with cutting-edge technologies. We're eager to engage with your thoughts and questions in the comments below. Let's continue pushing the boundaries of what's possible with technology together! Stay tuned for more updates and insights from our team.

If you enjoyed getting to know BG-AppealAI and its features and would like to support us, please take a moment to vote for our app here https://openexchange.intersystems.com/contest/36. Thank you!

3 Comments
ディスカッション (3)5
続けるにはログインするか新規登録を行ってください