diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-06-28 19:33:05 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-06-28 19:33:05 +0200 |
commit | 73d3b9c032eae2074726cd3668546af1c44a8323 (patch) | |
tree | c40b4e6447efa6d1d1c8618a3f79723f29e2db14 /src/org/spongycastle/util/io/pem/PemHeader.java | |
parent | 629417eb6b9db777b0db6b36d1c8ceb4c2760f7c (diff) |
The 'be ready for Jelly Beans' commit
- fix concurrentaccess occuring on JB
- JB does not allow to extract the private keys from the key storage, rewrite using the key storage to use JAVA API and the external-key management interface
Diffstat (limited to 'src/org/spongycastle/util/io/pem/PemHeader.java')
-rw-r--r-- | src/org/spongycastle/util/io/pem/PemHeader.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/org/spongycastle/util/io/pem/PemHeader.java b/src/org/spongycastle/util/io/pem/PemHeader.java new file mode 100644 index 0000000..4adb815 --- /dev/null +++ b/src/org/spongycastle/util/io/pem/PemHeader.java @@ -0,0 +1,66 @@ +package org.spongycastle.util.io.pem; + +public class PemHeader +{ + private String name; + private String value; + + public PemHeader(String name, String value) + { + this.name = name; + this.value = value; + } + + public String getName() + { + return name; + } + + public String getValue() + { + return value; + } + + public int hashCode() + { + return getHashCode(this.name) + 31 * getHashCode(this.value); + } + + public boolean equals(Object o) + { + if (!(o instanceof PemHeader)) + { + return false; + } + + PemHeader other = (PemHeader)o; + + return other == this || (isEqual(this.name, other.name) && isEqual(this.value, other.value)); + } + + private int getHashCode(String s) + { + if (s == null) + { + return 1; + } + + return s.hashCode(); + } + + private boolean isEqual(String s1, String s2) + { + if (s1 == s2) + { + return true; + } + + if (s1 == null || s2 == null) + { + return false; + } + + return s1.equals(s2); + } + +} |