패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.6.2

webcrypto

Flutter용 크로스 플랫폼 웹 암호화 API 구현.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
5.2만
좋아요
84
Pub 점수
140

패키지 설치

flutter pub add webcrypto

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

webcrypto 패키지는 Flutter용 크로스플랫폼 웹 암호화 API 구현을 제공하여 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스에서 키 생성, 암호화, 복호화 및 디지털 서명과 같은 보안 암호화 작업을 가능하게 합니다. 브라우저 기반의 웹 크립토 API와 유사한 일관된 인터페이스를 제공하여 Flutter 애플리케이션에서 안전한 데이터 처리를 쉽게 구현할 수 있습니다. 플랫폼별 코드 없이 강력한 보안 기능이 필요한 앱에 특히 유용합니다. 이 패키지는 Google에서 유지보수되며 GitHub에서 오픈소스로 공개되어 있습니다.

사용 사례

  • 안전한 데이터 암호화
  • 디지털 서명 검증
  • 키 관리
  • 크로스 플랫폼 암호화
  • 보안 토큰 처리

주요 기능

  • 크로스 플랫폼 호환성
  • 웹 크립토 API 사양을 준수
  • 대칭 및 비대칭 암호화를 지원합니다
  • 오픈소스이며 구글에서 유지 관리함
  • 내장 코드가 필요하지 않습니다

적합한 대상

  • 안전한 데이터 저장이 필요한 앱
  • 인증 시스템
  • 안전한 통신 프로토콜
  • 개인정보 보호 중심 애플리케이션
  • 웹 크립토 API에 익숙한 개발자

고려 사항

  • 암호화 개념에 대한 이해가 필요합니다
  • 고성능 암호화 중심 워크로드에 적합하지 않습니다
  • Dart의 비동기 모델에 의존합니다
  • 표준 웹 크립토 알고리즘에 한정
  • 생산 환경 사용을 위해 추가 검증이 필요할 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Cross-Platform Web Cryptography Implementation

This package provides a cross-platform implementation of the Web Cryptography API.

Disclaimer: This is not an officially supported Google product.

This packages provides an implementation of the Web Cryptography API across multiple platforms. Outside the browser, this package features a native implementation embedding BoringSSL using dart:ffi. When used inside a web browser this package wraps the window.crypto APIs and providing the same Dart API as the native implementation.

This way, package:webcrypto provides the same crypto API on Android, iOS, Web, Windows, Linux and Mac.

Example

import 'dart:convert' show base64, utf8;
import 'package:webcrypto/webcrypto.dart';

Future<void> main() async {
  final digest = await Hash.sha256.digestBytes(utf8.encode('Hello World'));
  print(base.encode(digest));
}

Coverage Status

Features:

  • Get random bytes
  • Digest (sha-1/sha-256/sha-384/sha-512)
  • HMAC (sign/verify)
  • RSASSA-PKCS1-v1_5 (sign/verify)
  • RSA-PSS (sign/verify)
  • ECDSA (sign/verify)
  • RSA-OAEP (encrypt/decrypt)
  • AES-CTR, AES-CBC, AES-GCM (encrypt/decrypt)
  • ECDH (deriveBits)
  • HKDF (deriveBits)
  • PBKDF2 (deriveBits)
  • BoringSSL, Chrome and Firefox implementations pass the same test cases.

Missing:

  • Exceptions and errors thrown for invalid input is not tested yet.
  • The native implementation executes on the main-thread, however, all expensive APIs are asynchronous, so they can be offloaded in the future.

For a discussion of the API design of this package, see doc/design-rationale-md.

System dependencies

When you have a dependency on package:webcrypto, it will use hooks to build BoringSSL. Thus, your system must have:

  • cmake, and,
  • a C compiler (like gcc or clang)

Limitations

This package has a few limitations compared to the Web Cryptography API. For a discussion of parity with Web Cryptography APIs see doc/webcrypto-parity.md.

  • deriveKey is not supported, however, keys can always be created from derivedBits which is supported.
  • wrapKey is not supported, however, keys can be exported and encrypted.
  • unwrapKey is not supported, however, keys can be decrypted and imported.
  • AES-KW is not supported because it does not support encrypt/decrypt.

Compatibility notes

This package has many tests cases to asses compatibility across the native implementation using BoringSSL and various browser implementations of the Web Cryptography APIs.

At the moment compatibility testing is limited to native implementation, Chrome, Firefox and Safari.

Known Issues:

  • Chrome and BoringSSL does not support valid ECDH spki-formatted keys exported by Firefox prior to version 72.
  • Firefox does not support PKCS8 import/export for ECDSA and ECDH keys.
  • Firefox does not handle counter wrap around for AES-CTR.
  • Safari does not support P-521 for ECDSA and ECDH.
  • The browser implementation of streaming methods for encryption, decryption, signing and verification buffers the entire input, because window.crypto does not expose a streaming API. However, the native implementation using BoringSSL does support streaming.
  • In browsers, operations backed by window.crypto.subtle require a secure context. When loaded from an insecure context, package:webcrypto throws UnsupportedError for those operations with guidance to use HTTPS or a trustworthy local origin such as localhost. fillRandomBytes() continues to work because it uses window.crypto.getRandomValues(), which browsers expose outside secure contexts.

References

카테고리

의존성

의존성 목록 5 개

  • code_assets^1.0.0
  • ffi^2.0.0
  • hooks^2.0.0
  • meta^1.3.0
  • native_toolchain_cmake^0.3.0

소스 저장소

이 패키지를 사용하는 프로젝트