Skip to content

Instantly share code, notes, and snippets.

@y-yu
Created December 6, 2015 06:41
Show Gist options
  • Save y-yu/9fbb24c8c0ddea59ae3c to your computer and use it in GitHub Desktop.
Save y-yu/9fbb24c8c0ddea59ae3c to your computer and use it in GitHub Desktop.
ガチャ2
@startuml
participant ユーザー as User
participant アプリケーション as App
participant サーバー as Server
participant データベース as DB
User -> App: ガチャを引くボタンを押す
App -> Server: ガチャを引くリクエストを送信
Server -> Server: $A$, $B$を生成
Server -> Server: $X := Sign_d(A||B)$を生成
Server --> App: $A$, $B$, $X$を送信
loop Cの生成
App -> App: データ$C$を生成
App -> App: データ$C$に署名した$Y := Sign_D(C)$を生成
App -> App: $D := B \& Hash(A||Y)$を計算
break $D$がマスクのどれかと一致する
App -> Server: $A$, $B$, $X$, $C$, $Y$, $E$を送信
end
end
Server -> DB: $E$をデータベースから検索
break $E$がデータに存在しない
Server --> App: エラー
end
Server -> Server: $Extract_e(X) \stackrel{?}{=} A||B$を検証
break 一致しない
Server --> App: エラー
end
Server -> Server: $Extract_E(Y) \stackrel{?}{=} C$を検証
break 一致しない
Server --> App: エラー
end
Server -> Server: $D' := B \& Hash(A||Y)$を計算
break $D'$がマスクのいずれとも一致しない
Server --> App: エラー
end
Server -> DB: マスクに対応するカードを取得したことを保存
Server --> App: マスクに対応するカードを取得したことを送信
App --> User: エラーでなければ、カードを表示
@enduml
@startuml
participant ユーザー as User
participant アプリケーション as App
participant サーバー as Server
participant データベース as DB
Server -> App: マスクを公開
App -> App: マスクを保存
Server -> Server: 秘密鍵$d$と公開鍵$e$を生成
Server -> App: 公開鍵$e$を送信
App -> App: 秘密鍵$D$と公開鍵$E$を生成
App -> Server: 公開鍵$E$を送信
Server -> DB: 公開鍵$E$をユーザー情報に紐付け
@enduml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment