Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
23ff57a6
Commit
23ff57a6
authored
1 year ago
by
Tri Vo
Browse files
Options
Downloads
Patches
Plain Diff
docs: Clarify when certificate is self-signed
Test: m Change-Id: I4a9fe5ff53ce3a7eaf02011df2d19b17111b7b8b
parent
7c778823
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
keystore/java/android/security/keystore/KeyGenParameterSpec.java
+15
-21
15 additions, 21 deletions
...e/java/android/security/keystore/KeyGenParameterSpec.java
with
15 additions
and
21 deletions
keystore/java/android/security/keystore/KeyGenParameterSpec.java
+
15
−
21
View file @
23ff57a6
...
...
@@ -75,16 +75,18 @@ import javax.security.auth.x500.X500Principal;
* {@link java.security.interfaces.ECPublicKey} or {@link java.security.interfaces.RSAPublicKey}
* interfaces.
*
* <p>For asymmetric key pairs, a
self-signed
X.509 certificate will be also generated and stored in
*
the Android
Keystore. This is because the {@link java.security.KeyStore} abstraction does not
*
support storing
key pairs without a certificate. The subject, serial number, and validity dates
*
of the
certificate can be customized in this spec. The
self-signed
certificate may be replaced at
*
a later time by a
certificate signed by a Certificate Authority (CA).
* <p>For asymmetric key pairs, a X.509 certificate will be also generated and stored in
the Android
* Keystore. This is because the {@link java.security.KeyStore} abstraction does not
support storing
* key pairs without a certificate. The subject, serial number, and validity dates
of the
* certificate can be customized in this spec. The certificate may be replaced at
a later time by a
* certificate signed by a Certificate Authority (CA).
*
* <p>NOTE: If a private key is not authorized to sign the self-signed certificate, then the
* certificate will be created with an invalid signature which will not verify. Such a certificate
* is still useful because it provides access to the public key. To generate a valid signature for
* the certificate the key needs to be authorized for all of the following:
* <p>NOTE: If attestation is not requested using {@link Builder#setAttestationChallenge(byte[])},
* generated certificate may be self-signed. If a private key is not authorized to sign the
* certificate, then the certificate will be created with an invalid signature which will not
* verify. Such a certificate is still useful because it provides access to the public key. To
* generate a valid signature for the certificate the key needs to be authorized for all of the
* following:
* <ul>
* <li>{@link KeyProperties#PURPOSE_SIGN},</li>
* <li>operation without requiring the user to be authenticated (see
...
...
@@ -989,12 +991,6 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
* @param purposes set of purposes (e.g., encrypt, decrypt, sign) for which the key can be
* used. Attempts to use the key for any other purpose will be rejected.
*
* <p>If the set of purposes for which the key can be used does not contain
* {@link KeyProperties#PURPOSE_SIGN}, the self-signed certificate generated by
* {@link KeyPairGenerator} of {@code AndroidKeyStore} provider will contain an
* invalid signature. This is OK if the certificate is only used for obtaining the
* public key from Android KeyStore.
*
* <p>See {@link KeyProperties}.{@code PURPOSE} flags.
*/
public
Builder
(
@NonNull
String
keystoreAlias
,
@KeyProperties
.
PurposeEnum
int
purposes
)
{
...
...
@@ -1140,7 +1136,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
}
/**
* Sets the subject used for the
self-signed
certificate of the generated key pair.
* Sets the subject used for the certificate of the generated key pair.
*
* <p>By default, the subject is {@code CN=fake}.
*/
...
...
@@ -1154,7 +1150,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
}
/**
* Sets the serial number used for the
self-signed
certificate of the generated key pair.
* Sets the serial number used for the certificate of the generated key pair.
*
* <p>By default, the serial number is {@code 1}.
*/
...
...
@@ -1168,8 +1164,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
}
/**
* Sets the start of the validity period for the self-signed certificate of the generated
* key pair.
* Sets the start of the validity period for the certificate of the generated key pair.
*
* <p>By default, this date is {@code Jan 1 1970}.
*/
...
...
@@ -1183,8 +1178,7 @@ public final class KeyGenParameterSpec implements AlgorithmParameterSpec, UserAu
}
/**
* Sets the end of the validity period for the self-signed certificate of the generated key
* pair.
* Sets the end of the validity period for the certificate of the generated key pair.
*
* <p>By default, this date is {@code Jan 1 2048}.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment