应用程序和服务器之间的安全连接
Secured connection between app and server
我尝试使用这些代码将我的离子应用程序连接到 apiserver (get)
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class EncryptionService {
url = 'https://api.am....com';
api-key='......'
constructor(private http: HttpClient) { }
newcheck(checkid: string ,cost: string,toname: string,tocode: string,passcode: string,date: string,checkfor: string,back: string): {
return this.http.get(`${this.url}?key=${this.api-key}&checkid=${encodeURI(checkid)}`);
}
}
我的 API 有 API 密钥并在 URL
中获取数据
- 我如何以安全的方式执行这些操作?
例如,防止有人监听和监视应用程序和服务器之间传输的数据?
- 防止有人分散注意力并伪造应用接收到的数据?
- 或者,确保此连接安全的任何措施
您似乎已经在使用加密的 https。
默认情况下应防止中间人攻击,因为浏览器会自动验证证书链。
我建议阅读 this guide 关于 https 的内容。
我尝试使用这些代码将我的离子应用程序连接到 apiserver (get)
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class EncryptionService {
url = 'https://api.am....com';
api-key='......'
constructor(private http: HttpClient) { }
newcheck(checkid: string ,cost: string,toname: string,tocode: string,passcode: string,date: string,checkfor: string,back: string): {
return this.http.get(`${this.url}?key=${this.api-key}&checkid=${encodeURI(checkid)}`);
}
}
我的 API 有 API 密钥并在 URL
中获取数据- 我如何以安全的方式执行这些操作? 例如,防止有人监听和监视应用程序和服务器之间传输的数据?
- 防止有人分散注意力并伪造应用接收到的数据?
- 或者,确保此连接安全的任何措施
您似乎已经在使用加密的 https。 默认情况下应防止中间人攻击,因为浏览器会自动验证证书链。
我建议阅读 this guide 关于 https 的内容。