diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
commit | da78a9e329e272dedb2400b79a3bdeebff387d47 (patch) | |
tree | e6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/ko/web/api/window/crypto/index.html | |
parent | 1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff) | |
download | translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2 translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip |
initial commit
Diffstat (limited to 'files/ko/web/api/window/crypto/index.html')
-rw-r--r-- | files/ko/web/api/window/crypto/index.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/files/ko/web/api/window/crypto/index.html b/files/ko/web/api/window/crypto/index.html new file mode 100644 index 0000000000..1b43534adc --- /dev/null +++ b/files/ko/web/api/window/crypto/index.html @@ -0,0 +1,75 @@ +--- +title: Window.crypto +slug: Web/API/Window/crypto +tags: + - API + - HTML DOM + - Property + - Reference + - Window +translation_of: Web/API/Window/crypto +--- +<div>{{APIRef}}</div> + +<p><span class="seoSummary"><strong><code>Window.crypto</code></strong>속성은 전역 객체인 {{domxref("Crypto")}} 객체를 반환합니다. <code>Crypto</code> 객체는 웹 페이지가 특정 암호학적 서비스에 접근할 수 있는 경로입니다.</span> <code>crypto</code> 속성 자체는 읽기 전용이지만, 모든 메서드(와 자식 객체 {{domxref("SubtleCrypto")}})의 메서드)는 읽기 전용이 아니므로 {{glossary("polyfill", "폴리필")}}을 통한 공격에 취약합니다.</p> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox">var <em>cryptoObj</em> = window.crypto || window.msCrypto; // for IE 11 +</pre> + +<h2 id="예제">예제</h2> + +<p id="Using_the_domxrefWindow.crypto_property_to_access_the_getRandomValues_method.">다음 예제는 {{domxref("Window.crypto")}} 속성을 통해 {{domxref("Crypto.getRandomValues", "getRandomValues()")}} 메서드에 접근합니다.</p> + +<h3 id="JavaScript">JavaScript</h3> + +<pre class="brush: js">genRandomNumbers = function getRandomNumbers() { + var array = new Uint32Array(10); + window.crypto.getRandomValues(array); + + var randText = document.getElementById("myRandText"); + randText.innerHTML = "The random numbers are: " + for (var i = 0; i < array.length; i++) { + randText.innerHTML += array[i] + " "; + } +}</pre> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><p id="myRandText">The random numbers are: </p> +<button type="button" onClick='genRandomNumbers()'>Generate 10 random numbers</button></pre> + +<h3 id="결과">결과</h3> + +<p>{{EmbedLiveSample('예제')}}</p> + +<h2 id="명세">명세</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">명세</th> + <th scope="col">상태</th> + <th scope="col">비고</th> + </tr> + <tr> + <td>{{SpecName("Web Crypto API", "#dfn-GlobalCrypto", "Window.crypto")}}</td> + <td>{{Spec2("Web Crypto API")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + + + +<p>{{Compat("api.Window.crypto")}}</p> + +<h2 id="같이_보기">같이 보기</h2> + +<ul> + <li>{{domxref("Window")}} 전역 객체</li> + <li>{{domxref("Crypto")}} 인터페이스</li> +</ul> |